Browse Source

合并认证服务器、基础服务,启用Hangfire自动建表,过滤上传文件目录提交

master
wanggang 1 year ago
parent
commit
60e5cafabf
  1. 4
      code/WebApp/vanilla/config/settings.js
  2. 4
      code/WebApp/vanilla/models/code-setting.js
  3. 4
      code/WebApp/vanilla/utils/validation.js
  4. 1
      code/src/Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseServiceEntityFrameworkCoreModule.cs
  5. 2
      code/src/Modules/BaseService/BaseService.Host/BaseService.Host.csproj
  6. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/.gitignore
  7. 255
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerDataSeeder.cs
  8. 125
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs
  9. 22
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/EntityFrameworkCore/AuthServerDbContext.cs
  10. 29
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/EntityFrameworkCore/AuthServerDbContextFactory.cs
  11. 274
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs
  12. 34
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  13. 88
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  14. 14
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json
  15. 10
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  16. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/tempkey.jwk
  17. 14
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccount.EntityFrameworkCore.csproj
  18. 29
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/appsettings.json
  19. 22
      code/src/SettleAccount.sln

4
code/WebApp/vanilla/config/settings.js

@ -1,5 +1,5 @@
export default { export default {
enableLocale: false, enableLocale: false,
baseURL: "http://dev.ccwin-in.com:10582/api", //baseURL: "http://dev.ccwin-in.com:10582/api",
//baseURL: "http://localhost:10130/api", baseURL: "http://localhost:44378/api",
}; };

4
code/WebApp/vanilla/models/code-setting.js

@ -37,8 +37,8 @@ const schema = {
}, },
}; };
const baseUrl = "settleaccount/CodeSetting"; const baseUrl = "settleaccount/code-setting";
const queryUrl = `${baseUrl}/GetList`; const queryUrl = `${baseUrl}/get-list`;
const detailsUrl = `${baseUrl}/GET/%s`; const detailsUrl = `${baseUrl}/GET/%s`;
const createUrl = `${baseUrl}/Create`; const createUrl = `${baseUrl}/Create`;
const updateUrl = `${baseUrl}/Update/%s`; const updateUrl = `${baseUrl}/Update/%s`;

4
code/WebApp/vanilla/utils/validation.js

@ -125,13 +125,17 @@ const getRules = (parentSchema, property, data) => {
rule.data = data; rule.data = data;
rule.schema = parentSchema; rule.schema = parentSchema;
rule.title ??= property.title; rule.title ??= property.title;
if (!rule.type && property.type !== "object") {
rule.type = property.type; rule.type = property.type;
}
if (rule.validator) { if (rule.validator) {
rule.validator = validators[rule.validator]; rule.validator = validators[rule.validator];
} }
if (!rule.message) { if (!rule.message) {
if (rule.required) { if (rule.required) {
rule.message = format(messages.required, property.title); rule.message = format(messages.required, property.title);
} else if (rule.type === "email") {
rule.message = format(messages.types.email, property.title);
} else if (rule.pattern) { } else if (rule.pattern) {
rule.message = format(messages.pattern.mismatch, property.title); rule.message = format(messages.pattern.mismatch, property.title);
} else if (property.type === "string" || property.type === "number" || property.type === "array") { } else if (property.type === "string" || property.type === "number" || property.type === "array") {

1
code/src/Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseServiceEntityFrameworkCoreModule.cs

@ -39,6 +39,7 @@ namespace BaseService.EntityFrameworkCore
private void ConfigureDbContext() private void ConfigureDbContext()
{ {
Configure<AbpDbContextOptions>(options => { options.UseSqlServer(); }); Configure<AbpDbContextOptions>(options => { options.UseSqlServer(); });
} }
} }

2
code/src/Modules/BaseService/BaseService.Host/BaseService.Host.csproj

@ -21,7 +21,7 @@
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" /> <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.1" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.1"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.8">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/.gitignore

@ -0,0 +1 @@
wwwroot/files/

255
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerDataSeeder.cs

@ -0,0 +1,255 @@
using IdentityServer4.Models;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Identity;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.ApiScopes;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.IdentityResources;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow;
using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource;
using ApiScope = Volo.Abp.IdentityServer.ApiScopes.ApiScope;
using Client = Volo.Abp.IdentityServer.Clients.Client;
namespace AuthServer.Host
{
public class AuthServerDataSeeder : IDataSeedContributor, ITransientDependency
{
private readonly IApiResourceRepository _apiResourceRepository;
private readonly IApiScopeRepository _apiScopeRepository;
private readonly IClientRepository _clientRepository;
private readonly IIdentityResourceDataSeeder _identityResourceDataSeeder;
private readonly IGuidGenerator _guidGenerator;
private readonly IPermissionDataSeeder _permissionDataSeeder;
public AuthServerDataSeeder(
IClientRepository clientRepository,
IApiResourceRepository apiResourceRepository,
IApiScopeRepository apiScopeRepository,
IIdentityResourceDataSeeder identityResourceDataSeeder,
IGuidGenerator guidGenerator,
IPermissionDataSeeder permissionDataSeeder)
{
_clientRepository = clientRepository;
_apiResourceRepository = apiResourceRepository;
_apiScopeRepository = apiScopeRepository;
_identityResourceDataSeeder = identityResourceDataSeeder;
_guidGenerator = guidGenerator;
_permissionDataSeeder = permissionDataSeeder;
}
[UnitOfWork]
public virtual async Task SeedAsync(DataSeedContext context)
{
await _identityResourceDataSeeder.CreateStandardResourcesAsync();
await CreateApiResourcesAsync();
await CreateApiScopesAsync();
await CreateClientsAsync();
}
private async Task CreateApiScopesAsync()
{
await CreateApiScopeAsync("BaseService");
await CreateApiScopeAsync("InternalGateway");
await CreateApiScopeAsync("WebAppGateway");
await CreateApiScopeAsync("TenantService");
await CreateApiScopeAsync("BusinessService");
await CreateApiScopeAsync("FileStorageService");
await CreateApiScopeAsync("IdentityService");
await CreateApiScopeAsync("SettleAccount");
}
private async Task CreateApiResourcesAsync()
{
var commonApiUserClaims = new[]
{
"email",
"email_verified",
"name",
"user_name",
"phone_number",
"phone_number_verified",
"role"
};
await CreateApiResourceAsync("IdentityService", commonApiUserClaims);
await CreateApiResourceAsync("BaseService", commonApiUserClaims);
await CreateApiResourceAsync("InternalGateway", commonApiUserClaims);
await CreateApiResourceAsync("WebAppGateway", commonApiUserClaims);
await CreateApiResourceAsync("TenantService", commonApiUserClaims);
await CreateApiResourceAsync("BusinessService", commonApiUserClaims);
await CreateApiResourceAsync("FileStorageService", commonApiUserClaims);
await CreateApiResourceAsync("SettleAccount", commonApiUserClaims);
}
private async Task<ApiResource> CreateApiResourceAsync(string name, IEnumerable<string> claims)
{
var apiResource = await _apiResourceRepository.FindByNameAsync(name);
if (apiResource == null)
{
apiResource = await _apiResourceRepository.InsertAsync(
new ApiResource(
_guidGenerator.Create(),
name,
name + " API"
),
autoSave: true
);
}
foreach (var claim in claims)
{
if (apiResource.FindClaim(claim) == null)
{
apiResource.AddUserClaim(claim);
}
}
return await _apiResourceRepository.UpdateAsync(apiResource);
}
private async Task<ApiScope> CreateApiScopeAsync(string name)
{
var apiScope = await _apiScopeRepository.GetByNameAsync(name);
if (apiScope == null)
{
apiScope = await _apiScopeRepository.InsertAsync(
new ApiScope(
_guidGenerator.Create(),
name,
name + " API"
),
autoSave: true
);
}
return apiScope;
}
private async Task CreateClientsAsync()
{
var commonScopes = new[]
{
"email",
"username",
"name",
"openid",
"profile",
"role",
"phone",
"address"
};
await CreateClientAsync(
"basic-web",
new[] { "IdentityService", "BaseService", "WebAppGateway", "FileStorageService", "TenantService", "BusinessService", "SettleAccount" },
new[] { "password" },
"1q2w3e*".Sha256()
);
//BaseDataService
await CreateClientAsync(
"business-app",
new[] { "InternalGateway", "IdentityService", "BaseService", "FileStorageService", "SettleAccount" },
new[] { "client_credentials" },
"1q2w3e*".Sha256(),
permissions: new[] { IdentityPermissions.Users.Default }
);
//FileStorge
await CreateClientAsync(
"file-app",
new[] { "InternalGateway", "IdentityService", "BaseService", "BaseDataService", "BusinessService" },
new[] { "client_credentials" },
"1q2w3e*".Sha256(),
permissions: new[] { IdentityPermissions.Users.Default }
);
}
private async Task<Client> CreateClientAsync(
string name,
IEnumerable<string> scopes,
IEnumerable<string> grantTypes,
string secret,
string redirectUri = null,
string postLogoutRedirectUri = null,
IEnumerable<string> permissions = null)
{
var client = await _clientRepository.FindByClientIdAsync(name);
if (client == null)
{
client = await _clientRepository.InsertAsync(
new Client(
_guidGenerator.Create(),
name
)
{
ClientName = name,
ProtocolType = "oidc",
Description = name,
AlwaysIncludeUserClaimsInIdToken = true,
AllowOfflineAccess = true,
AbsoluteRefreshTokenLifetime = 31536000, //365 days
AccessTokenLifetime = 31536000, //365 days
AuthorizationCodeLifetime = 300,
IdentityTokenLifetime = 300,
RequireConsent = false
},
autoSave: true
);
}
foreach (var scope in scopes)
{
if (client.FindScope(scope) == null)
{
client.AddScope(scope);
}
}
foreach (var grantType in grantTypes)
{
if (client.FindGrantType(grantType) == null)
{
client.AddGrantType(grantType);
}
}
if (client.FindSecret(secret) == null)
{
client.AddSecret(secret);
}
if (redirectUri != null)
{
if (client.FindRedirectUri(redirectUri) == null)
{
client.AddRedirectUri(redirectUri);
}
}
if (postLogoutRedirectUri != null)
{
if (client.FindPostLogoutRedirectUri(postLogoutRedirectUri) == null)
{
client.AddPostLogoutRedirectUri(postLogoutRedirectUri);
}
}
if (permissions != null)
{
await _permissionDataSeeder.SeedAsync(
ClientPermissionValueProvider.ProviderName,
name,
permissions
);
}
return await _clientRepository.UpdateAsync(client);
}
}
}

125
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs

@ -0,0 +1,125 @@
using AuthServer.Host.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;
using System;
using System.Linq;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.Auditing;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
using Volo.Abp.Threading;
namespace AuthServer.Host
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpIdentityServerEntityFrameworkCoreModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpAccountWebIdentityServerModule),
typeof(AbpAccountApplicationModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule)
)]
public class AuthServerHostModule : AbpModule
{
private const string DefaultCorsPolicyName = "Default";
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services.AddAbpDbContext<AuthServerDbContext>(options =>
{
options.AddDefaultRepositories();
});
Configure<AbpDbContextOptions>(options =>
{
options.UseSqlServer();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
});
context.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
context.Services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName,
builder =>
{
builder.WithOrigins(configuration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray())
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
Configure<AbpAuditingOptions>(options =>
{
options.IsEnabledForGetRequests = true;
options.ApplicationName = "AuthServer";
});
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseCorrelationId();
app.UseVirtualFiles();
app.UseRouting();
app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication();
app.UseMultiTenancy();
app.UseIdentityServer();
app.UseAuthorization();
app.UseAbpRequestLocalization();
app.UseAuditing();
AsyncHelper.RunSync(async () =>
{
using (var scope = context.ServiceProvider.CreateScope())
{
await scope.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync();
}
});
}
}
}

22
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/EntityFrameworkCore/AuthServerDbContext.cs

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
namespace AuthServer.Host.EntityFrameworkCore
{
public class AuthServerDbContext : AbpDbContext<AuthServerDbContext>
{
public AuthServerDbContext(DbContextOptions<AuthServerDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigureIdentityServer();
}
}
}

29
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/EntityFrameworkCore/AuthServerDbContextFactory.cs

@ -0,0 +1,29 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace AuthServer.Host.EntityFrameworkCore
{
public class AuthServerDbContextFactory : IDesignTimeDbContextFactory<AuthServerDbContext>
{
public AuthServerDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<AuthServerDbContext>()
.UseSqlServer(configuration.GetConnectionString("Default"));
return new AuthServerDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false);
return builder.Build();
}
}
}

274
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs

@ -0,0 +1,274 @@
using BaseService.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using Volo.Abp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Auditing;
using Volo.Abp.Autofac;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.HttpApi;
using Volo.Abp.Security.Claims;
using Volo.Abp.TenantManagement;
using Volo.Abp.Threading;
//using Win.Sfs.SettleAccount;
//using Win.Sfs.BaseData;
//using BaseData;
namespace BaseService
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(BaseServiceApplicationModule),
typeof(BaseServiceEntityFrameworkCoreModule),
typeof(BaseServiceHttpApiModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpTenantManagementHttpApiModule),
typeof(AbpIdentityHttpApiModule),
// typeof(BaseDataHttpApiModule),
//typeof(BaseDataApplicationContractsModule),
//typeof(SettleAccountHttpApiModule),
typeof(AbpAspNetCoreSerilogModule)
)]
public class BaseServiceHostModule : AbpModule
{
private const string DefaultCorsPolicyName = "Default";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClient();
Configure<AbpAntiForgeryOptions>(O => O.AutoValidate = false);
var configuration = context.Services.GetConfiguration();
ConfigureConventionalControllers();
ConfigureMultiTenancy();
ConfigureJwt(context, configuration);
//ConfigureSwagger(context);
ConfigureDbContext();
ConfigureRedis(context, configuration);
ConfigureAuditing();
//ConfigureCros(context, configuration);
ConfigureLocalization();
ConfigurePasswordSet(context);
}
private void ConfigureLocalization()
{
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
});
}
/// <summary>
/// 设置密码强度
/// </summary>
/// <param name="context"></param>
private void ConfigurePasswordSet(ServiceConfigurationContext context)
{
context.Services.Configure<IdentityOptions>(options =>
{
options.User.RequireUniqueEmail = true;
//options.Lockout.AllowedForNewUsers = true;
//options.Lockout.MaxFailedAccessAttempts = 2;
options.Password.RequireDigit = false;
options.Password.RequireLowercase = false;
options.Password.RequireNonAlphanumeric = false;
options.Password.RequireUppercase = false;
options.Password.RequiredLength = 6;
});
}
private static void ConfigureCros(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, builder =>
{
builder
.WithOrigins(
configuration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}
private void ConfigureAuditing()
{
Configure<AbpAuditingOptions>(options =>
{
options.IsEnabledForGetRequests = true;
options.ApplicationName = "BaseService";
});
}
private static void ConfigureRedis(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = configuration["Redis:Configuration"];
});
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
}
private void ConfigureDbContext()
{
Configure<AbpDbContextOptions>(options => { options.UseSqlServer(); });
}
private static void ConfigureSwagger(ServiceConfigurationContext context)
{
context.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "BaseService Service API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "请输入 JWT Token",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = "Bearer"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement()
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference {Type = ReferenceType.SecurityScheme, Id = "Bearer"}
},
new string[] { }
}
});
});
}
private static void ConfigureJwt(ServiceConfigurationContext context, IConfiguration configuration)
{
//context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
// .AddJwtBearer(options =>
// {
// options.Authority = configuration["AuthServer:Authority"];
// options.RequireHttpsMetadata = false;
// options.Audience = "BaseService";
// });
}
private void ConfigureMultiTenancy()
{
Configure<AbpMultiTenancyOptions>(options => { options.IsEnabled = true; });
}
private void ConfigureConventionalControllers()
{
//Configure<AbpAspNetCoreMvcOptions>(options =>
//{
// options.ConventionalControllers.Create(typeof(BaseServiceApplicationModule).Assembly);
//});
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options
.ConventionalControllers
.Create(typeof(BaseServiceApplicationModule).Assembly, opts
=>
{ opts.RootPath = "base"; })
;
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseCorrelationId();
app.UseVirtualFiles();
app.UseRouting();
app.UseCors(DefaultCorsPolicyName);
app.UseAuthentication();
app.UseMultiTenancy();
app.Use(async (ctx, next) =>
{
var currentPrincipalAccessor = ctx.RequestServices.GetRequiredService<ICurrentPrincipalAccessor>();
var map = new Dictionary<string, string>()
{
{ "sub", AbpClaimTypes.UserId },
{ "role", AbpClaimTypes.Role },
{ "email", AbpClaimTypes.Email },
{ "name", AbpClaimTypes.UserName },
};
var mapClaims = currentPrincipalAccessor.Principal.Claims.Where(p => map.Keys.Contains(p.Type)).ToList();
currentPrincipalAccessor.Principal.AddIdentity(new ClaimsIdentity(mapClaims.Select(p => new Claim(map[p.Type], p.Value, p.ValueType, p.Issuer))));
await next();
});
app.UseAbpRequestLocalization();
app.UseAuthorization();
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Identity Service API");
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
AsyncHelper.RunSync(async () =>
{
using (var scope = context.ServiceProvider.CreateScope())
{
await scope.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync();
}
});
}
}
}

34
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj

@ -1,4 +1,4 @@

<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
@ -24,7 +24,7 @@
<PackageReference Include="Hangfire.SqlServer" Version="1.7.24" /> <PackageReference Include="Hangfire.SqlServer" Version="1.7.24" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" /> <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.7" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.8">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
@ -44,25 +44,49 @@
<PackageReference Include="Volo.Abp.BlobStoring.FileSystem" Version="4.3.3" /> <PackageReference Include="Volo.Abp.BlobStoring.FileSystem" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Caching" Version="4.3.3" /> <PackageReference Include="Volo.Abp.Caching" Version="4.3.3" />
<PackageReference Include="Volo.Abp.HangFire" Version="4.3.3" /> <PackageReference Include="Volo.Abp.HangFire" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="4.3.3" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.TenantManagement.HttpApi" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Account.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="4.3.3" />
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="4.3.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\BaseService\BaseService.Application\BaseService.Application.csproj" />
<ProjectReference Include="..\..\..\BaseService\BaseService.EntityFrameworkCore\BaseService.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\BaseService\BaseService.HttpApi\BaseService.HttpApi.csproj" />
<ProjectReference Include="..\..\src\SettleAccount.HttpApi\SettleAccount.HttpApi.csproj" /> <ProjectReference Include="..\..\src\SettleAccount.HttpApi\SettleAccount.HttpApi.csproj" />
<ProjectReference Include="..\..\src\SettleAccount.Application\SettleAccount.Application.csproj" /> <ProjectReference Include="..\..\src\SettleAccount.Application\SettleAccount.Application.csproj" />
<ProjectReference Include="..\..\src\SettleAccount.EntityFrameworkCore\SettleAccount.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\src\SettleAccount.EntityFrameworkCore\SettleAccount.EntityFrameworkCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="EntityFrameworkCore\**" />
<Compile Remove="Logs\**" /> <Compile Remove="Logs\**" />
<Compile Remove="Migrations\**" />
<Content Remove="EntityFrameworkCore\**" />
<Content Remove="Logs\**" /> <Content Remove="Logs\**" />
<Content Remove="Migrations\**" />
<EmbeddedResource Remove="EntityFrameworkCore\**" />
<EmbeddedResource Remove="Logs\**" /> <EmbeddedResource Remove="Logs\**" />
<EmbeddedResource Remove="Migrations\**" />
<None Remove="EntityFrameworkCore\**" />
<None Remove="Logs\**" /> <None Remove="Logs\**" />
<None Remove="Migrations\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="EntityFrameworkCore\" /> <Folder Include="wwwroot\" />
<Folder Include="Migrations\" />
<Folder Include="wwwroot\files\host\my-file-container\" />
</ItemGroup> </ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions> <ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>

88
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs

@ -1,67 +1,56 @@
using System; using AuthServer.Host;
using System.Collections.Generic; using BaseService;
using System.IO; using Hangfire;
using System.Linq;
using IdentityModel;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using StackExchange.Redis;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using StackExchange.Redis;
using Swashbuckle.AspNetCore.SwaggerUI;
using System;
using System.IO;
using System.Linq;
using System.Text.Json;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.ExceptionHandling;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs.Hangfire;
using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Threading;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
using Win.Utils;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.ExceptionHandling;
using Swashbuckle.AspNetCore.SwaggerUI;
using Win.Sfs.Shared.Constant;
using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Microsoft.AspNetCore.Http.Features;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using Newtonsoft.Json.Serialization;
using System.Text.Json;
using Volo.Abp.Threading;
using Volo.Abp.Data;
using Hangfire;
using Volo.Abp.BackgroundJobs.Hangfire;
using Volo.Abp.Hangfire;
using Win.Sfs.SettleAccount.ImportExcelCommon; using Win.Sfs.SettleAccount.ImportExcelCommon;
using Volo.Abp.RabbitMQ; using Win.Sfs.Shared.Constant;
using Volo.Abp.EventBus.RabbitMq; using Win.Utils;
using Volo.Abp.AspNetCore.Mvc.ExceptionHandling;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
[DependsOn( [DependsOn(
typeof(AbpAutofacModule),
typeof(AuthServerHostModule),
typeof(BaseServiceHostModule),
typeof(SettleAccountApplicationModule), typeof(SettleAccountApplicationModule),
typeof(SettleAccountEntityFrameworkCoreModule), typeof(SettleAccountEntityFrameworkCoreModule),
typeof(SettleAccountHttpApiModule), typeof(SettleAccountHttpApiModule),
//typeof(AbpAspNetCoreMvcUiMultiTenancyModule), //typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpAutofacModule),
//typeof(AbpCachingStackExchangeRedisModule), //typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpEntityFrameworkCoreSqlServerModule), typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule),
@ -73,8 +62,6 @@ namespace Win.Sfs.SettleAccount
typeof(AbpBackgroundJobsHangfireModule) typeof(AbpBackgroundJobsHangfireModule)
//typeof(AbpEventBusRabbitMqModule) //typeof(AbpEventBusRabbitMqModule)
//typeof(AbpHangfireModule) //typeof(AbpHangfireModule)
//typeof(AbpSwashbuckleModule) //typeof(AbpSwashbuckleModule)
@ -103,7 +90,7 @@ namespace Win.Sfs.SettleAccount
//配置Redis //配置Redis
ConfigureRedis(context, configuration); ConfigureRedis(context, configuration);
//配置跨域资源共享 //配置跨域资源共享
ConfigureCors(context, configuration); //ConfigureCors(context, configuration);
//配置Swagger //配置Swagger
ConfigureSwaggerServices(context, configuration); ConfigureSwaggerServices(context, configuration);
//null: DTO的属性首字母保持大写 //null: DTO的属性首字母保持大写
@ -120,14 +107,10 @@ namespace Win.Sfs.SettleAccount
ConfigureBLOBTSecSummaryServices(configuration); ConfigureBLOBTSecSummaryServices(configuration);
ConfigureHangfire(context, configuration); ConfigureHangfire(context, configuration);
//context.Services.Configure<AbpExceptionHttpStatusCodeOptions>(options => //context.Services.Configure<AbpExceptionHttpStatusCodeOptions>(options =>
//{ //{
// options.Map("Volo.Qa:010002", System.Net.HttpStatusCode.Conflict); // options.Map("Volo.Qa:010002", System.Net.HttpStatusCode.Conflict);
//}); //});
//context.Services.Configure<AbpExceptionHandlingOptions>(options => //context.Services.Configure<AbpExceptionHandlingOptions>(options =>
//{ //{
@ -144,16 +127,13 @@ namespace Win.Sfs.SettleAccount
}); });
*/ */
//Configure<AbpRabbitMqEventBusOptions>(options => //Configure<AbpRabbitMqEventBusOptions>(options =>
//{ //{
// options.ClientName = "SettleAccount"; // options.ClientName = "SettleAccount";
// options.ExchangeName = "TestMessages"; // options.ExchangeName = "TestMessages";
//}); //});
//Configure<AbpBackgroundJobWorkerOptions>(options => //Configure<AbpBackgroundJobWorkerOptions>(options =>
//{ //{
// options.DefaultTimeout = 864000; //10 days (as seconds) // options.DefaultTimeout = 864000; //10 days (as seconds)
@ -165,10 +145,8 @@ namespace Win.Sfs.SettleAccount
x.MultipartBodyLengthLimit = int.MaxValue; x.MultipartBodyLengthLimit = int.MaxValue;
x.MemoryBufferThreshold = int.MaxValue; x.MemoryBufferThreshold = int.MaxValue;
}); });
} }
private void ConfigureBodyLengthLimit(ServiceConfigurationContext context) private void ConfigureBodyLengthLimit(ServiceConfigurationContext context)
{ {
context.Services.Configure<FormOptions>(options => context.Services.Configure<FormOptions>(options =>
@ -177,8 +155,6 @@ namespace Win.Sfs.SettleAccount
options.MultipartBodyLengthLimit = int.MaxValue; options.MultipartBodyLengthLimit = int.MaxValue;
options.MultipartHeadersLengthLimit = int.MaxValue; options.MultipartHeadersLengthLimit = int.MaxValue;
}); });
} }
@ -204,6 +180,7 @@ namespace Win.Sfs.SettleAccount
}); });
}); });
} }
/// <summary> /// <summary>
/// 大众-存储二配实际输出表 /// 大众-存储二配实际输出表
/// </summary> /// </summary>
@ -226,6 +203,7 @@ namespace Win.Sfs.SettleAccount
}); });
}); });
} }
/// <summary> /// <summary>
/// 奔腾-二配实际输出打印表的保存路径 /// 奔腾-二配实际输出打印表的保存路径
/// </summary> /// </summary>
@ -258,7 +236,6 @@ namespace Win.Sfs.SettleAccount
opt.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; opt.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
//opt.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter()); //opt.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter());
}); });
} }
private void ConfigureException() private void ConfigureException()
@ -285,11 +262,8 @@ namespace Win.Sfs.SettleAccount
=> =>
{ opts.RootPath = "settleaccount"; }); { opts.RootPath = "settleaccount"; });
}); });
} }
private void ConfigureCache(IConfiguration configuration) private void ConfigureCache(IConfiguration configuration)
{ {
Configure<AbpDistributedCacheOptions>(options => Configure<AbpDistributedCacheOptions>(options =>
@ -331,7 +305,6 @@ namespace Win.Sfs.SettleAccount
// options.ApiName = "SettleAccount"; // options.ApiName = "SettleAccount";
// }); // });
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options => .AddJwtBearer(options =>
{ {
@ -339,7 +312,6 @@ namespace Win.Sfs.SettleAccount
options.RequireHttpsMetadata = false; options.RequireHttpsMetadata = false;
options.Audience = "SettleAccount"; options.Audience = "SettleAccount";
}); });
} }
} }
@ -417,16 +389,17 @@ namespace Win.Sfs.SettleAccount
} }
} }
private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration) private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration)
{ {
context.Services.AddHangfire(config => context.Services.AddHangfire(config =>
{ {
config.UseSqlServerStorage(configuration.GetConnectionString("SettleAccountService")); config.UseSqlServerStorage(configuration.GetConnectionString("SettleAccountService"), new Hangfire.SqlServer.SqlServerStorageOptions
{
PrepareSchemaIfNecessary = true
});
}); });
} }
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
{ {
context.Services.AddCors(options => context.Services.AddCors(options =>
@ -449,7 +422,6 @@ namespace Win.Sfs.SettleAccount
}); });
} }
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)
{ {
var app = context.GetApplicationBuilder(); var app = context.GetApplicationBuilder();

14
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json

@ -1,14 +1,16 @@
{ {
"App": { "App": {
"CorsOrigins": "https://*.abc.com,http://localhost:9528,http://149.223.116.5:8088" "CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
}, },
//"ConnectionStrings": { //"ConnectionStrings": {
// "Default": "Server=LAPTOP-V3U07C2O;Database=ABP;user id=sa;Password=1q2w!@#", // "Default": "Server=LAPTOP-V3U07C2O;Database=ABP;user id=sa;Password=1q2w!@#",
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService1;user id=sa;Password=1q2w!@#;" // "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService1;user id=sa;Password=1q2w!@#;"
//}, //},
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", //"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;" //"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"SettleAccountService": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
@ -87,8 +89,10 @@
"AuthServer": { "AuthServer": {
"Authority": "http://149.223.116.5:8066", //"Authority": "http://dev.ccwin-in.com:10580",
"AlwaysAllowAuthorization": false "Authority": "http://localhost:44378",
"ClientId": "basic-web",
"ClientSecret": "1q2w3e*"
}, },
"Redis": { "Redis": {

10
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -3,8 +3,10 @@
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088" "CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", //"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;" //"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;"
"SettleAccountService": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
}, },
"Serilog": { "Serilog": {
@ -70,7 +72,9 @@
"AuthServer": { "AuthServer": {
"Authority": "http://dev.ccwin-in.com:10580", "Authority": "http://dev.ccwin-in.com:10580",
"AlwaysAllowAuthorization": false //"Authority": "http://localhost:10130",
"ClientId": "basic-web",
"ClientSecret": "1q2w3e*"
}, },
"Redis": { "Redis": {

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/tempkey.jwk

@ -0,0 +1 @@
{"AdditionalData":{},"Alg":"RS256","Crv":null,"D":"mkeKcDJDeFxfcUlsAiiqTRAVA5uIhEFm8ZSnSZgYdWCTNs1Yz6fmGcB9rHzoCAhVn3Z3okacYYrQgKTYRr_33iAepQTtwC9IYDOrrBpbKgHI1pYEu7nJGeeYCW_tnUuADV6s8qt5UPUg0HpluP1scZFmWYKVsD9JSAOEX53lZWAF4gANuR9N_w5S7wb5-qsUcrD7Mb3AecREKAFBJ1aNHlPNoZdU0fCRSLA2dwPVl8Bf-2BQdB4Wgec0ZBUw-t40QALzSc-gLWa8oL6E4cFtHjguguK_abXuqX0he6qSszLpVyHOpF5dReJ22UgRLI5BPaGRn_1Ppen1uLWBtKvdmQ","DP":"4Ud2MTnS6rD1_mhmvvSSH_koj7DU3Eu03ornkzbtYtxKEsr1jQYot5kn3Tz82kiOfz6EqCq9avBhzWFGqacNv9rnoSZDQoBgn_hwtYQuhQnZizMIBsfu2YMvuWpSOqXsiJKMOY2voVj2MCcrKzkzO2emjnCgSgGLgnTpPNMeZZk","DQ":"j9N4UFrWXFrnN8ueV5BvCFPVR3rCkQM5VtYbVuNr4Hg_vZ7q4BfChC6cOoVzu8mdbEhUZStNjWw-qDfUU4g5UfIyy8Wd5PPaaoR71eMpY1sUeDpmwUzcXnhaiouaBjmkEdRbFqpPcEKdvM9lgI9shGPBuGigK_BnCBUTKMDa4EM","E":"AQAB","K":null,"KeyId":"22FA1AC0DC170A29CAA724FD239AEF60","Kid":"22FA1AC0DC170A29CAA724FD239AEF60","Kty":"RSA","N":"xwskHLqkzp8bt0X3P8tUKM_2laM7dKz5X3UdJm27WSziqA_2oaccYY8XMnBdZeRPlXbHMAnUmZocOAbRcUKvymtTl47OGpLlazEdcKUDDklzcC9jf_zMi2C4Fy6M_j3kh1YT0oZqUSEUHbBtHRgbP7gyIM1eUyM7-jf2GRFzvC5zZYGaqKAqXDvQ1ew9Juk_QEndRgIpiEU9_-QlIrVBrUqTdxWf3SsbsBpOZgYKsE88TNUHFCBpFmQtyoEDKtmz-k3JkruBLJlZIztOqtgnDWddUvIrzM_NZ-zjzd72JGDiTZ0EHqQL66-LXSXtf_LB4Db-Hy-FceePOckN7BlRiQ","Oth":null,"P":"4-IwXgK0CpLFiIlWb-pRu1q1k2QM4scvKAi_ri9zPoRXnxnoCfjY11cR3ptHzRCVO9fepTorjO2S5v4COW2DYs1Xd59qMxDYWHuZ02qfk3tK068W0HkXcfL7MpHNqeSPAFQKWlnn4IyyoxHTaBiGHHYK3ddgBzbp95_zC-MWvy8","Q":"35oGpIH5mCZzVuB6DxC43IisMmeaSnnSsnPlF13liLGq-smVnDcVkHLy7pyPG4xnr9M2AKqKn2wwGX8mazzAbLNfGzob3Zb_OyL2ocMJXIKdAK3raUteKtFcWtzMneQ2aMh7Ui4OlAgTrCc-l6TjzYACgMUzSdfNxL30EmmzjMc","QI":"1-5k_RJIlPsfG-thor9IHAlyj1l_aiOcE9zgpsGurna7XhqfHFFGMjoCcqZi9-zPX4ZyTbCJtwsgIy2cwjZJ3kMDc4Fxf4WmB4okZcMPTq0EkOa6D251hv6rjJW0JWNWtEwrk-87aCi4BtlBFIG3TiXWKGtUC-PsDEiGtDlQAxM","Use":null,"X":null,"X5t":null,"X5tS256":null,"X5u":null,"Y":null,"KeySize":2048,"HasPrivateKey":true,"CryptoProviderFactory":{"CryptoProviderCache":{},"CustomCryptoProvider":null,"CacheSignatureProviders":true,"SignatureProviderObjectPoolCacheSize":48}}

14
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccount.EntityFrameworkCore.csproj

@ -12,9 +12,21 @@
<OutputPath>..\..\OutPut</OutputPath> <OutputPath>..\..\OutPut</OutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="5.0.0" /> <PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.8">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

29
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/appsettings.json

@ -0,0 +1,29 @@
{
"AuthServer": {
"Authority": "http://dev.ccwin-in.com:10580",
//"Authority": "http://localhost:10130",
"ClientId": "basic-web",
"ClientSecret": "1q2w3e*"
},
"App": {
"CorsOrigins": "http://localhost:9527,http://dev.ccwin-in.com:10588,http://localhost:44307"
},
"ConnectionStrings": {
"SettleAccountService": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
},
"ElasticSearch": {
"Url": "http://localhost:9200"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"RePassword": "111111"
}

22
code/src/SettleAccount.sln

@ -1,19 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.29728.190 VisualStudioVersion = 17.6.33717.318
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gateways", "Gateways", "{593B8559-1521-4E54-A7DF-7F58E5F6EA86}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{61F21377-02D4-40C5-80B3-F0C2999CE6B7}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{61F21377-02D4-40C5-80B3-F0C2999CE6B7}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{A6179011-0C7F-440A-A559-B9C90BB0229A}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{A6179011-0C7F-440A-A559-B9C90BB0229A}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{BD0465F1-50F8-4913-8B01-7C2E44CEED27}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAppGateway.Host", "Gateways\WebAppGateway\WebAppGateway.Host\WebAppGateway.Host.csproj", "{E2CC3E8A-924B-47AC-BDEC-C12B4BC9B7DD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternalGateway.Host", "Gateways\InternalGateway\InternalGateway.Host\InternalGateway.Host.csproj", "{165D6706-6E02-4506-94D6-823412C5412C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MicroServices", "MicroServices", "{1C1B27DC-DEDF-4067-9791-660302A09C66}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MicroServices", "MicroServices", "{1C1B27DC-DEDF-4067-9791-660302A09C66}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Win.Abp", "Win.Abp", "{1853A9CF-DB6D-4612-A6EA-8815E011F2C9}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Win.Abp", "Win.Abp", "{1853A9CF-DB6D-4612-A6EA-8815E011F2C9}"
@ -70,14 +62,6 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E2CC3E8A-924B-47AC-BDEC-C12B4BC9B7DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2CC3E8A-924B-47AC-BDEC-C12B4BC9B7DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2CC3E8A-924B-47AC-BDEC-C12B4BC9B7DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2CC3E8A-924B-47AC-BDEC-C12B4BC9B7DD}.Release|Any CPU.Build.0 = Release|Any CPU
{165D6706-6E02-4506-94D6-823412C5412C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{165D6706-6E02-4506-94D6-823412C5412C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{165D6706-6E02-4506-94D6-823412C5412C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{165D6706-6E02-4506-94D6-823412C5412C}.Release|Any CPU.Build.0 = Release|Any CPU
{7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B}.Debug|Any CPU.Build.0 = Debug|Any CPU {7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B}.Release|Any CPU.ActiveCfg = Release|Any CPU {7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -159,8 +143,6 @@ Global
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{E2CC3E8A-924B-47AC-BDEC-C12B4BC9B7DD} = {593B8559-1521-4E54-A7DF-7F58E5F6EA86}
{165D6706-6E02-4506-94D6-823412C5412C} = {593B8559-1521-4E54-A7DF-7F58E5F6EA86}
{1853A9CF-DB6D-4612-A6EA-8815E011F2C9} = {61F21377-02D4-40C5-80B3-F0C2999CE6B7} {1853A9CF-DB6D-4612-A6EA-8815E011F2C9} = {61F21377-02D4-40C5-80B3-F0C2999CE6B7}
{7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B} = {5E5C6DAB-A70E-44A9-93C9-4A2C4AE837A7} {7E3E3AEB-C7C4-495D-B963-8A3B4DB0CB3B} = {5E5C6DAB-A70E-44A9-93C9-4A2C4AE837A7}
{9B9733F4-F13E-428E-AA4A-BA68432FE3B8} = {61F21377-02D4-40C5-80B3-F0C2999CE6B7} {9B9733F4-F13E-428E-AA4A-BA68432FE3B8} = {61F21377-02D4-40C5-80B3-F0C2999CE6B7}

Loading…
Cancel
Save