chore 优化代码
This commit is contained in:
@ -26,7 +26,7 @@ namespace KonSoft;
|
||||
typeof(AbpAccountApplicationModule),
|
||||
typeof(AbpAccountHttpApiModule),
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
)]
|
||||
public class KonSoftAuthServerModule : AbpModule
|
||||
{
|
||||
public override void PreConfigureServices(ServiceConfigurationContext context)
|
||||
@ -53,7 +53,8 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
|
||||
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
|
||||
{
|
||||
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "59464dba-b66e-48cd-8b81-2e4a9c08c977");
|
||||
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx",
|
||||
"59464dba-b66e-48cd-8b81-2e4a9c08c977");
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -77,23 +78,17 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
{
|
||||
options.StyleBundles.Configure(
|
||||
BasicThemeBundles.Styles.Global,
|
||||
bundle =>
|
||||
{
|
||||
bundle.AddFiles("/global-styles.css");
|
||||
}
|
||||
bundle => { bundle.AddFiles("/global-styles.css"); }
|
||||
);
|
||||
});
|
||||
|
||||
Configure<AbpAuditingOptions>(options =>
|
||||
{
|
||||
options.IsEnabledForGetRequests = true;
|
||||
options.ApplicationName = "AuthServer";
|
||||
options.IsEnabledForGetRequests = true;
|
||||
options.ApplicationName = "AuthServer";
|
||||
});
|
||||
|
||||
Configure<AbpBackgroundJobOptions>(options =>
|
||||
{
|
||||
options.IsJobExecutionEnabled = false;
|
||||
});
|
||||
Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; });
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
{
|
||||
@ -138,4 +133,4 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ namespace KonSoft;
|
||||
[Dependency(ReplaceServices = true)]
|
||||
public class KonSoftBrandingProvider : DefaultBrandingProvider
|
||||
{
|
||||
private IStringLocalizer<KonSoftResource> _localizer;
|
||||
private readonly IStringLocalizer<KonSoftResource> _localizer;
|
||||
|
||||
public KonSoftBrandingProvider(IStringLocalizer<KonSoftResource> localizer)
|
||||
{
|
||||
@ -16,4 +16,4 @@ public class KonSoftBrandingProvider : DefaultBrandingProvider
|
||||
}
|
||||
|
||||
public override string AppName => _localizer["AppName"];
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,13 @@
|
||||
@page
|
||||
@using System.Net
|
||||
@using KonSoft.Shared.Localization.Localization
|
||||
@using Microsoft.AspNetCore.Http.Extensions
|
||||
@using Microsoft.AspNetCore.Mvc.Localization
|
||||
@using KonSoft.Pages
|
||||
@using KonSoft.Shared.Localization.Localization
|
||||
@using Volo.Abp.Users
|
||||
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
|
||||
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
|
||||
@using Volo.Abp.Ui.Branding
|
||||
@model IndexModel
|
||||
@using Volo.Abp.Users
|
||||
@model KonSoft.Pages.IndexModel
|
||||
@inject IHtmlLocalizer<KonSoftResource> L
|
||||
@inject ICurrentUser CurrentUser
|
||||
@inject IBrandingProvider BrandingProvider
|
||||
@ -45,32 +46,32 @@
|
||||
<abp-row>
|
||||
<abp-column size="_6">
|
||||
<div class="mr-auto p-2 float-start">
|
||||
<div class="">
|
||||
@if (CurrentUser.IsAuthenticated)
|
||||
{
|
||||
<div class="">
|
||||
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account" class="me-2">@L["MyAccount"]</a>
|
||||
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account" asp-route-returnUrl="/" >@L["Logout"]</a>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
|
||||
}
|
||||
</div>
|
||||
<div class="">
|
||||
@if (CurrentUser.IsAuthenticated)
|
||||
{
|
||||
<div class="">
|
||||
<a abp-button="Outline_Primary" asp-controller="Manage" asp-action="Index" asp-area="Account" class="me-2">@L["MyAccount"]</a>
|
||||
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account" asp-route-returnUrl="/">@L["Logout"]</a>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a abp-button="Primary" asp-controller="Login" asp-action="Index" asp-area="Account">@L["Login"]</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</abp-column>
|
||||
|
||||
<abp-column size="_6">
|
||||
<div class="ml-auto p-2 float-end">
|
||||
<abp-dropdown>
|
||||
<abp-dropdown-button text="@Model.CurrentLanguage" />
|
||||
@if (@Model.Languages != null)
|
||||
<abp-dropdown-button text="@Model.CurrentLanguage"/>
|
||||
@if (Model.Languages != null)
|
||||
{
|
||||
<abp-dropdown-menu>
|
||||
@foreach (var language in Model.Languages)
|
||||
{
|
||||
var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={System.Net.WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}");
|
||||
var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}");
|
||||
<abp-dropdown-item href="@languageUrl">@language.DisplayName</abp-dropdown-item>
|
||||
}
|
||||
</abp-dropdown-menu>
|
||||
@ -82,18 +83,18 @@
|
||||
|
||||
@if (Model.Applications != null)
|
||||
{
|
||||
<hr class="m-2" />
|
||||
<hr class="m-2"/>
|
||||
|
||||
<abp-row class="mt-3">
|
||||
@foreach (var application in Model.Applications)
|
||||
{
|
||||
<abp-column size-md="@Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid.ColumnSize._4" class="mb-2">
|
||||
<abp-column size-md="@ColumnSize._4" class="mb-2">
|
||||
<abp-card>
|
||||
<abp-card-body>
|
||||
@{
|
||||
var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri;
|
||||
@{
|
||||
var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri;
|
||||
}
|
||||
|
||||
|
||||
@if (!application.LogoUri.IsNullOrEmpty())
|
||||
{
|
||||
<div class="mx-auto">
|
||||
@ -115,4 +116,4 @@
|
||||
</div>
|
||||
</abp-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -9,6 +9,12 @@ namespace KonSoft.Pages;
|
||||
|
||||
public class IndexModel : AbpPageModel
|
||||
{
|
||||
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
|
||||
{
|
||||
OpenIdApplicationRepository = openIdApplicationRepository;
|
||||
LanguageProvider = languageProvider;
|
||||
}
|
||||
|
||||
public List<OpenIddictApplication>? Applications { get; protected set; }
|
||||
|
||||
public IReadOnlyList<LanguageInfo>? Languages { get; protected set; }
|
||||
@ -19,12 +25,6 @@ public class IndexModel : AbpPageModel
|
||||
|
||||
protected ILanguageProvider LanguageProvider { get; }
|
||||
|
||||
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
|
||||
{
|
||||
OpenIdApplicationRepository = openIdApplicationRepository;
|
||||
LanguageProvider = languageProvider;
|
||||
}
|
||||
|
||||
public async Task OnGetAsync()
|
||||
{
|
||||
Applications = await OpenIdApplicationRepository.GetListAsync();
|
||||
@ -32,4 +32,4 @@ public class IndexModel : AbpPageModel
|
||||
Languages = await LanguageProvider.GetLanguagesAsync();
|
||||
CurrentLanguage = CultureInfo.CurrentCulture.DisplayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace KonSoft;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -1,33 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.BackgroundJobs.Controllers
|
||||
namespace KonSoft.BackgroundJobs.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,4 +22,4 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@ -1,13 +1,12 @@
|
||||
namespace KonSoft.BackgroundJobs
|
||||
namespace KonSoft.BackgroundJobs;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
@ -1,33 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.BackgroundWorker.Controllers
|
||||
namespace KonSoft.BackgroundWorker.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,4 +22,4 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@ -1,13 +1,12 @@
|
||||
namespace KonSoft.BackgroundWorker
|
||||
namespace KonSoft.BackgroundWorker;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
@ -1,33 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.InternalGateway.Controllers
|
||||
namespace KonSoft.InternalGateway.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,4 +22,4 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@ -1,13 +1,12 @@
|
||||
namespace KonSoft.InternalGateway
|
||||
namespace KonSoft.InternalGateway;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
@ -1,33 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.PublicGateway.Controllers
|
||||
namespace KonSoft.PublicGateway.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,4 +22,4 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@ -1,13 +1,12 @@
|
||||
namespace KonSoft.PublicGateway
|
||||
namespace KonSoft.PublicGateway;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
@ -23,9 +23,9 @@ public class AdminHttpApiHostModule : AbpModule
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context: context,
|
||||
authority: configuration["AuthServer:Authority"]!,
|
||||
scopes: ["AdministrationService"],
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
["AdministrationService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Administration Service API"
|
||||
);
|
||||
@ -74,4 +74,4 @@ public class AdminHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,12 @@
|
||||
using Volo.Abp.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace KonSoft.Admin.DbMigrations
|
||||
namespace KonSoft.Admin.DbMigrations;
|
||||
|
||||
public class AdminDataSeeder : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
public class AdminDataSeeder : IDataSeedContributor, ITransientDependency
|
||||
public Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
public Task SeedAsync(DataSeedContext context)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,21 +6,20 @@ using Volo.Abp.EventBus.Distributed;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
using Volo.Abp.Uow;
|
||||
|
||||
namespace KonSoft.Admin.DbMigrations
|
||||
namespace KonSoft.Admin.DbMigrations;
|
||||
|
||||
public class AdminPendingEfCoreMigrationsChecker : PendingEfCoreMigrationsChecker<AdminDbContext>
|
||||
{
|
||||
public class AdminPendingEfCoreMigrationsChecker : PendingEfCoreMigrationsChecker<AdminDbContext>
|
||||
public AdminPendingEfCoreMigrationsChecker(IUnitOfWorkManager unitOfWorkManager,
|
||||
IServiceProvider serviceProvider,
|
||||
ICurrentTenant currentTenant,
|
||||
IDistributedEventBus distributedEventBus,
|
||||
IAbpDistributedLock abpDistributedLock) : base(unitOfWorkManager,
|
||||
serviceProvider,
|
||||
currentTenant,
|
||||
distributedEventBus,
|
||||
abpDistributedLock,
|
||||
"Clean")
|
||||
{
|
||||
public AdminPendingEfCoreMigrationsChecker(IUnitOfWorkManager unitOfWorkManager,
|
||||
IServiceProvider serviceProvider,
|
||||
ICurrentTenant currentTenant,
|
||||
IDistributedEventBus distributedEventBus,
|
||||
IAbpDistributedLock abpDistributedLock) : base(unitOfWorkManager,
|
||||
serviceProvider,
|
||||
currentTenant,
|
||||
distributedEventBus,
|
||||
abpDistributedLock,
|
||||
"Clean")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using KonSoft.Admin;
|
||||
using System;
|
||||
using KonSoft.Admin;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Serilog;
|
||||
using System;
|
||||
|
||||
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Admin.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Admin.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,6 @@ using KonSoft.Dispatch.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Volo.Abp;
|
||||
@ -24,9 +23,9 @@ public class DispatchHttpApiHostModule : AbpModule
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context: context,
|
||||
authority: configuration["AuthServer:Authority"]!,
|
||||
scopes: ["DispatchService"],
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
["DispatchService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Dispatch Service API"
|
||||
);
|
||||
@ -75,4 +74,4 @@ public class DispatchHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.Dispatch;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Dispatch.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Dispatch.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,6 @@ using KonSoft.Payment.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Volo.Abp;
|
||||
@ -24,9 +23,9 @@ public class PaymentHttpApiHostModule : AbpModule
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context: context,
|
||||
authority: configuration["AuthServer:Authority"]!,
|
||||
scopes: ["PaymentService"],
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
["PaymentService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Payment Service API"
|
||||
);
|
||||
@ -75,4 +74,4 @@ public class PaymentHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.Payment;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Payment.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Payment.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.Report;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,6 @@ using KonSoft.Report.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Volo.Abp;
|
||||
@ -24,9 +23,9 @@ public class ReportHttpApiHostModule : AbpModule
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context: context,
|
||||
authority: configuration["AuthServer:Authority"]!,
|
||||
scopes: ["ReportService"],
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
["ReportService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "Report Service API"
|
||||
);
|
||||
@ -75,4 +74,4 @@ public class ReportHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Report.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Report.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -9,4 +9,4 @@ public class HomeController : AbpController
|
||||
{
|
||||
return Redirect("~/swagger");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace KonSoft.TenantManagement;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public async static Task<int> Main(string[] args)
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
@ -53,4 +53,4 @@ public class Program
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,6 @@ using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using KonSoft.TenantManagement.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Volo.Abp;
|
||||
@ -24,9 +23,9 @@ public class TenantManagementHttpApiHostModule : AbpModule
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
|
||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||
context: context,
|
||||
authority: configuration["AuthServer:Authority"]!,
|
||||
scopes: ["TenantManagementService"],
|
||||
context,
|
||||
configuration["AuthServer:Authority"]!,
|
||||
["TenantManagementService"],
|
||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||
apiTitle: "TenantManagement Service API"
|
||||
);
|
||||
@ -75,4 +74,4 @@ public class TenantManagementHttpApiHostModule : AbpModule
|
||||
app.UseAbpSerilogEnrichers();
|
||||
app.UseConfiguredEndpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.TenantManagement.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.TenantManagement.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||
</system.webServer>
|
||||
</location>
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="x-powered-by" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@ -25,4 +25,4 @@ public class AdminApplicationContractsModule : AbpModule
|
||||
{
|
||||
AdminDtoExtensions.Configure();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,28 +1,26 @@
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.ObjectExtending;
|
||||
using Volo.Abp.Threading;
|
||||
using Volo.Abp.Threading;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
|
||||
public static class AdminDtoExtensions
|
||||
{
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
||||
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
OneTimeRunner.Run(() =>
|
||||
{
|
||||
/* You can add extension properties to DTOs
|
||||
* defined in the depended modules.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ObjectExtensionManager.Instance
|
||||
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title");
|
||||
*
|
||||
* See the documentation for more:
|
||||
* https://docs.abp.io/en/abp/latest/Object-Extensions
|
||||
*/
|
||||
/* You can add extension properties to DTOs
|
||||
* defined in the depended modules.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ObjectExtensionManager.Instance
|
||||
* .AddOrUpdateProperty<IdentityRoleDto, string>("Title");
|
||||
*
|
||||
* See the documentation for more:
|
||||
* https://docs.abp.io/en/abp/latest/Object-Extensions
|
||||
*/
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
public class AddressDto
|
||||
{
|
||||
public class AddressDto
|
||||
{
|
||||
public string ContactName { get; set; }
|
||||
public string ContactPhone { get; set; }
|
||||
public string DetailAddress { get; set; }
|
||||
public string City { get; set; }
|
||||
public string District { get; set; }
|
||||
}
|
||||
}
|
||||
public string ContactName { get; set; }
|
||||
public string ContactPhone { get; set; }
|
||||
public string DetailAddress { get; set; }
|
||||
public string City { get; set; }
|
||||
public string District { get; set; }
|
||||
}
|
||||
@ -1,25 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class CreateOrderDto
|
||||
{
|
||||
public class CreateOrderDto
|
||||
{
|
||||
[Required]
|
||||
public Guid CustomerId { get; set; }
|
||||
[Required]
|
||||
public Guid ServiceCategoryId { get; set; }
|
||||
[Required]
|
||||
public DateTime ServiceTime { get; set; }
|
||||
[Required]
|
||||
public decimal Amount { get; set; }
|
||||
[Required]
|
||||
public AddressDto Address { get; set; }
|
||||
[Required] public Guid CustomerId { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
[Required] public Guid ServiceCategoryId { get; set; }
|
||||
|
||||
[Required] public DateTime ServiceTime { get; set; }
|
||||
|
||||
[Required] public decimal Amount { get; set; }
|
||||
|
||||
[Required] public AddressDto Address { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
@ -1,14 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class CreateServiceCategoryDto
|
||||
{
|
||||
public class CreateServiceCategoryDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
}
|
||||
}
|
||||
public string Name { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
}
|
||||
@ -1,26 +1,20 @@
|
||||
using KonSoft.Admin.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using System;
|
||||
using KonSoft.Admin.Enums;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class OrderDto
|
||||
{
|
||||
public class OrderDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string OrderSN { get; set; }
|
||||
public Guid CustomerId { get; set; }
|
||||
public Guid? WorkerId { get; set; }
|
||||
public ServiceCategoryDto? ServiceCategory { get; set; }
|
||||
public DateTime ServiceTime { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public decimal PaidAmount { get; set; }
|
||||
public string PaymentMethod { get; set; }
|
||||
public AddressDto Address { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
public Guid Id { get; set; }
|
||||
public string OrderSN { get; set; }
|
||||
public Guid CustomerId { get; set; }
|
||||
public Guid? WorkerId { get; set; }
|
||||
public ServiceCategoryDto? ServiceCategory { get; set; }
|
||||
public DateTime ServiceTime { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public decimal PaidAmount { get; set; }
|
||||
public string PaymentMethod { get; set; }
|
||||
public AddressDto Address { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
@ -1,12 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
public class PayOrderDto
|
||||
{
|
||||
public class PayOrderDto
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,66 +1,60 @@
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class ProductDto : CreateProductDto
|
||||
{
|
||||
public class ProductDto: CreateProductDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 嵌套子类
|
||||
/// </summary>
|
||||
public List<CreateProductDto> Children { get; set; } = new();
|
||||
}
|
||||
|
||||
public class CreateProductDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 分类名称
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品编码
|
||||
/// </summary>
|
||||
public string Code { get; private set; }
|
||||
/// <summary>
|
||||
/// 商品价格
|
||||
/// </summary>
|
||||
public decimal Price { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品描述
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类类型(大类或小类)
|
||||
/// </summary>
|
||||
public string Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父分类ID
|
||||
/// </summary>
|
||||
public Guid? ParentId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品状态(在售/下架等)
|
||||
/// </summary>
|
||||
public string Status { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public int Order { get; private set; }
|
||||
}
|
||||
|
||||
public class UpdateProductDto: CreateProductDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 嵌套子类
|
||||
/// </summary>
|
||||
public List<CreateProductDto> Children { get; set; } = new();
|
||||
}
|
||||
|
||||
public class CreateProductDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 分类名称
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品编码
|
||||
/// </summary>
|
||||
public string Code { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品价格
|
||||
/// </summary>
|
||||
public decimal Price { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品描述
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类类型(大类或小类)
|
||||
/// </summary>
|
||||
public string Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父分类ID
|
||||
/// </summary>
|
||||
public Guid? ParentId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品状态(在售/下架等)
|
||||
/// </summary>
|
||||
public string Status { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public int Order { get; private set; }
|
||||
}
|
||||
|
||||
public class UpdateProductDto : CreateProductDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
@ -1,17 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class ServiceCategoryDto
|
||||
{
|
||||
public class ServiceCategoryDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
public int Level { get; set; }
|
||||
public List<ServiceCategoryDto> Children { get; set; } = new List<ServiceCategoryDto>();
|
||||
}
|
||||
}
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
public int Level { get; set; }
|
||||
public List<ServiceCategoryDto> Children { get; set; } = new();
|
||||
}
|
||||
@ -1,17 +1,12 @@
|
||||
using KonSoft.Admin.Enums;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace KonSoft.Admin.Dtos
|
||||
namespace KonSoft.Admin.Dtos;
|
||||
|
||||
public class WorkerDto : EntityDto<Guid>
|
||||
{
|
||||
public class WorkerDto : EntityDto<Guid>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public List<Guid> SkillCategoryIds { get; set; } = new(); // 擅长服务类型
|
||||
}
|
||||
}
|
||||
public string Name { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public List<Guid> SkillCategoryIds { get; set; } = new(); // 擅长服务类型
|
||||
}
|
||||
@ -1,28 +1,28 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IOrderAppService : IApplicationService
|
||||
{
|
||||
public interface IOrderAppService : IApplicationService
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建订单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<OrderDto> CreateAsync(CreateOrderDto input);
|
||||
Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input);
|
||||
Task AssignAsync(Guid orderId, Guid workerId);
|
||||
Task StartServiceAsync(Guid orderId);
|
||||
Task CompleteServiceAsync(Guid orderId);
|
||||
Task ConfirmAsync(Guid orderId);
|
||||
Task CancelAsync(Guid orderId, string reason);
|
||||
Task DeleteAsync(params Guid[] ids);
|
||||
Task EditAsync(OrderDto input);
|
||||
Task<OrderDto> GetAsync(Guid id);
|
||||
Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建订单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<OrderDto> CreateAsync(CreateOrderDto input);
|
||||
|
||||
Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input);
|
||||
Task AssignAsync(Guid orderId, Guid workerId);
|
||||
Task StartServiceAsync(Guid orderId);
|
||||
Task CompleteServiceAsync(Guid orderId);
|
||||
Task ConfirmAsync(Guid orderId);
|
||||
Task CancelAsync(Guid orderId, string reason);
|
||||
Task DeleteAsync(params Guid[] ids);
|
||||
Task EditAsync(OrderDto input);
|
||||
Task<OrderDto> GetAsync(Guid id);
|
||||
Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IProductAppService : IApplicationService
|
||||
{
|
||||
Task CreateAsync(CreateProductDto input);
|
||||
Task UpdateAsync(UpdateProductDto input);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<ProductDto> GetAsync(Guid id);
|
||||
Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input);
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices
|
||||
{
|
||||
public interface IProductService: IApplicationService
|
||||
{
|
||||
Task CreateAsync(CreateProductDto input);
|
||||
Task UpdateAsync(UpdateProductDto input);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<ProductDto> GetAsync(Guid id);
|
||||
Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input);
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,13 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IServiceCategoryAppService
|
||||
{
|
||||
public interface IServiceCategoryAppService
|
||||
{
|
||||
Task<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<List<ServiceCategoryDto>> GetTreeAsync();
|
||||
}
|
||||
}
|
||||
Task<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<List<ServiceCategoryDto>> GetTreeAsync();
|
||||
}
|
||||
@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
public interface IWorkerAppService : IApplicationService
|
||||
{
|
||||
public interface IWorkerAppService : IApplicationService
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace KonSoft.Admin.IApplicationServices;
|
||||
|
||||
namespace KonSoft.Admin.IApplicationServices
|
||||
public interface IWorkerAssignmentService
|
||||
{
|
||||
public interface IWorkerAssignmentService
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,4 +17,4 @@ public class AdminPermissionDefinitionProvider : PermissionDefinitionProvider
|
||||
{
|
||||
return LocalizableString.Create<AdminResource>(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,4 +6,4 @@ public static class AdminPermissions
|
||||
|
||||
//Add your own permission names. Example:
|
||||
//public const string MyPermission1 = GroupName + ".MyPermission1";
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using KonSoft.Admin.Localization;
|
||||
using KonSoft.Admin.Localization;
|
||||
using Volo.Abp.Application.Services;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
@ -14,4 +11,4 @@ public abstract class AdminAppService : ApplicationService
|
||||
{
|
||||
LocalizationResource = typeof(AdminResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,4 +17,4 @@ public class AdminApplicationAutoMapperProfile : Profile
|
||||
CreateMap<AddressDto, AddressInfo>();
|
||||
CreateMap<ServiceCategoryDto, ServiceCategory>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,14 +18,11 @@ namespace KonSoft.Admin;
|
||||
typeof(AbpTenantManagementApplicationModule),
|
||||
typeof(AbpFeatureManagementApplicationModule),
|
||||
typeof(AbpSettingManagementApplicationModule)
|
||||
)]
|
||||
)]
|
||||
public class AdminApplicationModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
Configure<AbpAutoMapperOptions>(options =>
|
||||
{
|
||||
options.AddMaps<AdminApplicationModule>();
|
||||
});
|
||||
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<AdminApplicationModule>(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,165 +1,166 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using KonSoft.Admin.Repositories;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using KonSoft.Admin.IRepositories;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices
|
||||
namespace KonSoft.Admin.ApplicationServices;
|
||||
|
||||
public class OrderAppService(IOrderRepository orderRepository) : ApplicationService, IOrderAppService
|
||||
{
|
||||
public class OrderAppService(IOrderRepository orderRepository) : ApplicationService, IOrderAppService
|
||||
private readonly IOrderRepository _orderRepository = orderRepository;
|
||||
|
||||
/// <summary>
|
||||
/// 分配师傅
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="workerId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task AssignAsync(Guid orderId, Guid workerId)
|
||||
{
|
||||
private readonly IOrderRepository _orderRepository = orderRepository;
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.AssignWorker(workerId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分配师傅
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="workerId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task AssignAsync(Guid orderId, Guid workerId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.AssignWorker(workerId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="reason"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task CancelAsync(Guid orderId, string reason)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.Cancel(reason);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="reason"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task CancelAsync(Guid orderId, string reason)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.Cancel(reason);
|
||||
}
|
||||
/// <summary>
|
||||
/// 完成订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task CompleteServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.CompleteService();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 完成订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task CompleteServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.CompleteService();
|
||||
}
|
||||
/// <summary>
|
||||
/// 确认订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task ConfirmAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.ConfirmCompletion();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确认订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task ConfirmAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.ConfirmCompletion();
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建订单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<OrderDto> CreateAsync(CreateOrderDto input)
|
||||
{
|
||||
// 生成订单号 TODO
|
||||
var orderSN = "SN001";
|
||||
var address = ObjectMapper.Map<AddressDto, AddressInfo>(input.Address);
|
||||
var order = new Order(Guid.NewGuid(), orderSN, input.CustomerId, input.ServiceCategoryId, input.ServiceTime,
|
||||
input.Amount, address, input.Remark);
|
||||
|
||||
/// <summary>
|
||||
/// 创建订单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<OrderDto> CreateAsync(CreateOrderDto input)
|
||||
{
|
||||
// 生成订单号 TODO
|
||||
var orderSN = "SN001";
|
||||
var address = ObjectMapper.Map<AddressDto, AddressInfo>(input.Address);
|
||||
var order = new Order(Guid.NewGuid(), orderSN, input.CustomerId, input.ServiceCategoryId, input.ServiceTime, input.Amount, address, input.Remark);
|
||||
await _orderRepository.InsertAsync(order);
|
||||
return ObjectMapper.Map<Order, OrderDto>(order);
|
||||
}
|
||||
|
||||
await _orderRepository.InsertAsync(order);
|
||||
return ObjectMapper.Map<Order, OrderDto>(order);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据订单ID删除订单
|
||||
/// </summary>
|
||||
/// <param name="id">订单ID</param>
|
||||
public async Task DeleteAsync(params Guid[] ids)
|
||||
{
|
||||
// 根据ID删除订单
|
||||
await _orderRepository.DeleteAsync(x => ids.Contains(x.Id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据订单ID删除订单
|
||||
/// </summary>
|
||||
/// <param name="id">订单ID</param>
|
||||
public async Task DeleteAsync(params Guid[] ids)
|
||||
{
|
||||
// 根据ID删除订单
|
||||
await _orderRepository.DeleteAsync(x => ids.Contains(x.Id));
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改订单信息
|
||||
/// </summary>
|
||||
/// <param name="input">订单DTO对象</param>
|
||||
/// s
|
||||
public async Task EditAsync(OrderDto input)
|
||||
{
|
||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||
var order = await _orderRepository.FindAsync(o => o.Id == input.Id) ??
|
||||
throw new BusinessException("订单找不到").WithData("Id", input.Id);
|
||||
|
||||
/// <summary>
|
||||
/// 修改订单信息
|
||||
/// </summary>
|
||||
/// <param name="input">订单DTO对象</param>s
|
||||
public async Task EditAsync(OrderDto input)
|
||||
{
|
||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||
var order = await _orderRepository.FindAsync(o => o.Id == input.Id) ??
|
||||
throw new BusinessException("订单找不到").WithData("Id", input.Id);
|
||||
// 将输入的DTO字段映射到订单实体
|
||||
ObjectMapper.Map(input, order);
|
||||
|
||||
// 将输入的DTO字段映射到订单实体
|
||||
ObjectMapper.Map(input, order);
|
||||
// 更新订单
|
||||
await _orderRepository.UpdateAsync(order);
|
||||
}
|
||||
|
||||
// 更新订单
|
||||
await _orderRepository.UpdateAsync(order);
|
||||
}
|
||||
/// <summary>
|
||||
/// 支付
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 支付
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
/// 开始订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task StartServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.StartService();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始订单
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task StartServiceAsync(Guid orderId)
|
||||
{
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == orderId);
|
||||
order.StartService();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据订单ID获取单个订单
|
||||
/// </summary>
|
||||
public async Task<OrderDto> GetAsync(Guid id)
|
||||
{
|
||||
// 根据ID从数据库查询订单
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == id);
|
||||
|
||||
/// <summary>
|
||||
/// 根据订单ID获取单个订单
|
||||
/// </summary>
|
||||
public async Task<OrderDto> GetAsync(Guid id)
|
||||
{
|
||||
// 根据ID从数据库查询订单
|
||||
var order = await _orderRepository.GetAsync(o => o.Id == id);
|
||||
// 转换为OrderDto返回
|
||||
return ObjectMapper.Map<Order, OrderDto>(order);
|
||||
}
|
||||
|
||||
// 转换为OrderDto返回
|
||||
return ObjectMapper.Map<Order, OrderDto>(order);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取所有订单列表
|
||||
/// </summary>
|
||||
public async Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input)
|
||||
{
|
||||
// 查询所有订单
|
||||
var orders = await _orderRepository.GetPagedListAsync(input.SkipCount, input.MaxResultCount, "Id");
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有订单列表
|
||||
/// </summary>
|
||||
public async Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input)
|
||||
{
|
||||
// 查询所有订单
|
||||
var orders = await _orderRepository.GetPagedListAsync(input.SkipCount, input.MaxResultCount, "Id");
|
||||
var totalCount = await _orderRepository.CountAsync();
|
||||
|
||||
var totalCount = await _orderRepository.CountAsync();
|
||||
var orderDtos = ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
|
||||
|
||||
var orderDtos = ObjectMapper.Map<List<Order>, List<OrderDto>>(orders);
|
||||
|
||||
return new PagedResultDto<OrderDto>(totalCount, orderDtos);
|
||||
}
|
||||
return new PagedResultDto<OrderDto>(totalCount, orderDtos);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using KonSoft.Admin.IRepositories;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices;
|
||||
|
||||
public class ProductAppAppService(IProductRepository repository) : ApplicationService, IProductAppService
|
||||
{
|
||||
private readonly IProductRepository repository = repository;
|
||||
|
||||
/// <summary>
|
||||
/// 创建产品
|
||||
/// </summary>
|
||||
public async Task CreateAsync(CreateProductDto input)
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
var product = new Product(id, input.Name, input.Code, input.Price, input.Description, input.Type,
|
||||
input.ParentId, input.Status, input.Order);
|
||||
await repository.InsertAsync(product);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
await repository.DeleteAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
public async Task<ProductDto> GetAsync(Guid id)
|
||||
{
|
||||
var product = await repository.GetAsync(x => x.Id == id);
|
||||
return ObjectMapper.Map<Product, ProductDto>(product);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询集合
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input)
|
||||
{
|
||||
var query = await repository.GetPageRootListAsync(input.SkipCount, input.MaxResultCount,
|
||||
x => x.ParentId == null);
|
||||
var all = await repository.GetListAsync(x => x.ParentId != null);
|
||||
foreach (var item in query)
|
||||
{
|
||||
BuildChildren(item, all);
|
||||
}
|
||||
|
||||
var totalCount = await repository.CountAsync(x => x.ParentId == null);
|
||||
|
||||
var productDtos = ObjectMapper.Map<List<Product>, List<ProductDto>>(query);
|
||||
|
||||
return new PagedResultDto<ProductDto>(totalCount, productDtos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateAsync(UpdateProductDto input)
|
||||
{
|
||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||
var order = await repository.FindAsync(o => o.Id == input.Id) ??
|
||||
throw new BusinessException("商品找不到").WithData("Id", input.Id);
|
||||
|
||||
// 将输入的DTO字段映射到订单实体
|
||||
ObjectMapper.Map(input, order);
|
||||
|
||||
// 更新订单
|
||||
await repository.UpdateAsync(order);
|
||||
}
|
||||
|
||||
private static void BuildChildren(Product parent, List<Product> all)
|
||||
{
|
||||
var children = all
|
||||
.Where(x => x.ParentId == parent.Id)
|
||||
.OrderBy(x => x.Order)
|
||||
.ToList();
|
||||
|
||||
parent.Children = children;
|
||||
|
||||
foreach (var child in children)
|
||||
{
|
||||
BuildChildren(child, all); // 递归
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using KonSoft.Admin.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices
|
||||
{
|
||||
public class ProductAppService(IProductRepository repository) : ApplicationService, IProductService
|
||||
{
|
||||
private readonly IProductRepository repository = repository;
|
||||
|
||||
/// <summary>
|
||||
/// 创建产品
|
||||
/// </summary>
|
||||
public async Task CreateAsync(CreateProductDto input)
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
var product = new Product(id, input.Name, input.Code, input.Price, input.Description, input.Type, input.ParentId, input.Status, input.Order);
|
||||
await repository.InsertAsync(product);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
await repository.DeleteAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
public async Task<ProductDto> GetAsync(Guid id)
|
||||
{
|
||||
var product = await repository.GetAsync(x => x.Id == id);
|
||||
return ObjectMapper.Map<Product, ProductDto>(product);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询集合
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input)
|
||||
{
|
||||
var query = await repository.GetPageRootListAsync(input.SkipCount, input.MaxResultCount, x => x.ParentId == null);
|
||||
var all = await repository.GetListAsync(x => x.ParentId != null);
|
||||
foreach (var item in query)
|
||||
{
|
||||
BuildChildren(item, all);
|
||||
}
|
||||
var totalCount = await repository.CountAsync(x => x.ParentId == null);
|
||||
|
||||
var productDtos = ObjectMapper.Map<List<Product>, List<ProductDto>>(query);
|
||||
|
||||
return new PagedResultDto<ProductDto>(totalCount, productDtos);
|
||||
}
|
||||
|
||||
private static void BuildChildren(Product parent, List<Product> all)
|
||||
{
|
||||
var children = all
|
||||
.Where(x => x.ParentId == parent.Id)
|
||||
.OrderBy(x => x.Order)
|
||||
.ToList();
|
||||
|
||||
parent.Children = children;
|
||||
|
||||
foreach (var child in children)
|
||||
{
|
||||
BuildChildren(child, all); // 递归
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateAsync(UpdateProductDto input)
|
||||
{
|
||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||
var order = await repository.FindAsync(o => o.Id == input.Id) ??
|
||||
throw new BusinessException("商品找不到").WithData("Id", input.Id);
|
||||
|
||||
// 将输入的DTO字段映射到订单实体
|
||||
ObjectMapper.Map(input, order);
|
||||
|
||||
// 更新订单
|
||||
await repository.UpdateAsync(order);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,75 +1,77 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices
|
||||
namespace KonSoft.Admin.ApplicationServices;
|
||||
|
||||
public class ServiceCategoryAppService : ApplicationService, IServiceCategoryAppService
|
||||
{
|
||||
public class ServiceCategoryAppService : ApplicationService, IServiceCategoryAppService
|
||||
private readonly IRepository<ServiceCategory, Guid> _repository;
|
||||
|
||||
|
||||
public ServiceCategoryAppService(IRepository<ServiceCategory, Guid> repository)
|
||||
{
|
||||
private readonly IRepository<ServiceCategory, Guid> _repository;
|
||||
|
||||
|
||||
public ServiceCategoryAppService(IRepository<ServiceCategory, Guid> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public async Task<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input)
|
||||
{
|
||||
ServiceCategory parent = null;
|
||||
if (input.ParentId.HasValue)
|
||||
{
|
||||
parent = await _repository.GetAsync(input.ParentId.Value);
|
||||
}
|
||||
|
||||
var category = new ServiceCategory(Guid.NewGuid(), input.Name);
|
||||
category.SetParent(parent);
|
||||
|
||||
|
||||
await _repository.InsertAsync(category);
|
||||
|
||||
|
||||
return ObjectMapper.Map<ServiceCategory, ServiceCategoryDto>(category);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
var hasChildren = await _repository.AnyAsync(c => c.ParentId == id);
|
||||
if (hasChildren) throw new InvalidOperationException("存在子节点无法删除!");
|
||||
|
||||
|
||||
await _repository.DeleteAsync(o => o.Id == id);
|
||||
}
|
||||
|
||||
public async Task<List<ServiceCategoryDto>> GetTreeAsync()
|
||||
{
|
||||
var allCategories = await _repository.GetListAsync();
|
||||
|
||||
// 构建树
|
||||
var lookup = allCategories.ToDictionary(c => c.Id, c => ObjectMapper.Map<ServiceCategory, ServiceCategoryDto>(c));
|
||||
var rootList = new List<ServiceCategoryDto>();
|
||||
|
||||
|
||||
foreach (var dto in lookup.Values)
|
||||
{
|
||||
if (dto.ParentId.HasValue && lookup.ContainsKey(dto.ParentId.Value))
|
||||
{
|
||||
lookup[dto.ParentId.Value].Children.Add(dto);
|
||||
}
|
||||
else
|
||||
{
|
||||
rootList.Add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
return rootList.OrderBy(c => c.Name).ToList();
|
||||
}
|
||||
_repository = repository;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input)
|
||||
{
|
||||
ServiceCategory parent = null;
|
||||
if (input.ParentId.HasValue)
|
||||
{
|
||||
parent = await _repository.GetAsync(input.ParentId.Value);
|
||||
}
|
||||
|
||||
var category = new ServiceCategory(Guid.NewGuid(), input.Name);
|
||||
category.SetParent(parent);
|
||||
|
||||
|
||||
await _repository.InsertAsync(category);
|
||||
|
||||
|
||||
return ObjectMapper.Map<ServiceCategory, ServiceCategoryDto>(category);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
var hasChildren = await _repository.AnyAsync(c => c.ParentId == id);
|
||||
if (hasChildren)
|
||||
{
|
||||
throw new InvalidOperationException("存在子节点无法删除!");
|
||||
}
|
||||
|
||||
|
||||
await _repository.DeleteAsync(o => o.Id == id);
|
||||
}
|
||||
|
||||
public async Task<List<ServiceCategoryDto>> GetTreeAsync()
|
||||
{
|
||||
var allCategories = await _repository.GetListAsync();
|
||||
|
||||
// 构建树
|
||||
var lookup =
|
||||
allCategories.ToDictionary(c => c.Id, c => ObjectMapper.Map<ServiceCategory, ServiceCategoryDto>(c));
|
||||
var rootList = new List<ServiceCategoryDto>();
|
||||
|
||||
|
||||
foreach (var dto in lookup.Values)
|
||||
{
|
||||
if (dto.ParentId.HasValue && lookup.ContainsKey(dto.ParentId.Value))
|
||||
{
|
||||
lookup[dto.ParentId.Value].Children.Add(dto);
|
||||
}
|
||||
else
|
||||
{
|
||||
rootList.Add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
return rootList.OrderBy(c => c.Name).ToList();
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
using KonSoft.Admin.Dtos;
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices
|
||||
{
|
||||
public class WorkerAppService : CrudAppService<Worker, WorkerDto, Guid>, IWorkerAppService
|
||||
{
|
||||
public WorkerAppService(IRepository<Worker, Guid> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IApplicationServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.ApplicationServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 分配家政人员 TODO
|
||||
/// </summary>
|
||||
public class WorkerAssignmentService : ApplicationService, IWorkerAssignmentService
|
||||
{
|
||||
private readonly IRepository<Worker, Guid> _workerRepository;
|
||||
private readonly IRepository<Order, Guid> _orderRepository;
|
||||
|
||||
public WorkerAssignmentService(IRepository<Worker, Guid> workerRepository, IRepository<Order, Guid> orderRepository)
|
||||
{
|
||||
_workerRepository = workerRepository;
|
||||
_orderRepository = orderRepository;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,2 +1,3 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
[assembly:InternalsVisibleToAttribute("KonSoft.Admin.Application.Tests")]
|
||||
|
||||
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Application.Tests")]
|
||||
@ -3,4 +3,4 @@
|
||||
public static class AdminDomainErrorCodes
|
||||
{
|
||||
/* You can add your business exception error codes here, as constants */
|
||||
}
|
||||
}
|
||||
@ -23,8 +23,8 @@ namespace KonSoft.Admin;
|
||||
typeof(AbpOpenIddictDomainSharedModule),
|
||||
typeof(AbpPermissionManagementDomainSharedModule),
|
||||
typeof(AbpSettingManagementDomainSharedModule),
|
||||
typeof(AbpTenantManagementDomainSharedModule)
|
||||
)]
|
||||
typeof(AbpTenantManagementDomainSharedModule)
|
||||
)]
|
||||
public class AdminDomainSharedModule : AbpModule
|
||||
{
|
||||
public override void PreConfigureServices(ServiceConfigurationContext context)
|
||||
@ -35,10 +35,7 @@ public class AdminDomainSharedModule : AbpModule
|
||||
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
||||
{
|
||||
options.FileSets.AddEmbedded<AdminDomainSharedModule>();
|
||||
});
|
||||
Configure<AbpVirtualFileSystemOptions>(options => { options.FileSets.AddEmbedded<AdminDomainSharedModule>(); });
|
||||
|
||||
Configure<AbpLocalizationOptions>(options =>
|
||||
{
|
||||
@ -55,4 +52,4 @@ public class AdminDomainSharedModule : AbpModule
|
||||
options.MapCodeNamespace("Admin", typeof(AdminResource));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,19 +4,19 @@ namespace KonSoft.Admin;
|
||||
|
||||
public static class AdminGlobalFeatureConfigurator
|
||||
{
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
||||
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
OneTimeRunner.Run(() =>
|
||||
{
|
||||
/* You can configure (enable/disable) global features of the used modules here.
|
||||
*
|
||||
* YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT!
|
||||
*
|
||||
* Please refer to the documentation to lear more about the Global Features System:
|
||||
* https://docs.abp.io/en/abp/latest/Global-Features
|
||||
*/
|
||||
/* You can configure (enable/disable) global features of the used modules here.
|
||||
*
|
||||
* YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT!
|
||||
*
|
||||
* Please refer to the documentation to lear more about the Global Features System:
|
||||
* https://docs.abp.io/en/abp/latest/Global-Features
|
||||
*/
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.ObjectExtending;
|
||||
using Volo.Abp.Threading;
|
||||
using Volo.Abp.Threading;
|
||||
|
||||
namespace KonSoft.Admin;
|
||||
|
||||
public static class AdminModuleExtensionConfigurator
|
||||
{
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
||||
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
@ -57,7 +54,7 @@ public static class AdminModuleExtensionConfigurator
|
||||
//validation rules
|
||||
property.Attributes.Add(new RequiredAttribute());
|
||||
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});
|
||||
|
||||
|
||||
property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true;
|
||||
|
||||
//...other configurations for this property
|
||||
@ -70,4 +67,4 @@ public static class AdminModuleExtensionConfigurator
|
||||
* https://docs.abp.io/en/abp/latest/Module-Entity-Extensions
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,22 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace KonSoft.Admin.Enums;
|
||||
|
||||
namespace KonSoft.Admin.Enums
|
||||
public enum OrderStatus
|
||||
{
|
||||
public enum OrderStatus
|
||||
{
|
||||
PendingPayment, // 待支付
|
||||
PaidWaitingAssign, // 已支付待派单
|
||||
AssignedWaitingService, // 已派单待服务
|
||||
InService, // 服务中
|
||||
WaitingConfirm, // 待用户确认
|
||||
Completed, // 已完成
|
||||
Canceled, // 已取消
|
||||
Refunding, // 退款中
|
||||
Refunded // 已退款
|
||||
|
||||
}
|
||||
}
|
||||
PendingPayment, // 待支付
|
||||
PaidWaitingAssign, // 已支付待派单
|
||||
AssignedWaitingService, // 已派单待服务
|
||||
InService, // 服务中
|
||||
WaitingConfirm, // 待用户确认
|
||||
Completed, // 已完成
|
||||
Canceled, // 已取消
|
||||
Refunding, // 退款中
|
||||
Refunded // 已退款
|
||||
}
|
||||
@ -5,5 +5,4 @@ namespace KonSoft.Admin.Localization;
|
||||
[LocalizationResourceName("Admin")]
|
||||
public class AdminResource
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -5,4 +5,4 @@ public static class AdminConsts
|
||||
public const string DbTablePrefix = "App";
|
||||
|
||||
public const string DbSchema = null;
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,6 @@ using Volo.Abp.FeatureManagement;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.Localization;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
using Volo.Abp.OpenIddict;
|
||||
using Volo.Abp.PermissionManagement.Identity;
|
||||
using Volo.Abp.PermissionManagement.OpenIddict;
|
||||
@ -60,4 +59,4 @@ public class AdminDomainModule : AbpModule
|
||||
context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,12 +17,11 @@ namespace KonSoft.Admin.Data;
|
||||
|
||||
public class AdminDbMigrationService : ITransientDependency
|
||||
{
|
||||
public ILogger<AdminDbMigrationService> Logger { get; set; }
|
||||
private readonly ICurrentTenant _currentTenant;
|
||||
|
||||
private readonly IDataSeeder _dataSeeder;
|
||||
private readonly IEnumerable<IAdminDbSchemaMigrator> _dbSchemaMigrators;
|
||||
private readonly ITenantRepository _tenantRepository;
|
||||
private readonly ICurrentTenant _currentTenant;
|
||||
|
||||
public AdminDbMigrationService(
|
||||
IDataSeeder dataSeeder,
|
||||
@ -38,6 +37,8 @@ public class AdminDbMigrationService : ITransientDependency
|
||||
Logger = NullLogger<AdminDbMigrationService>.Instance;
|
||||
}
|
||||
|
||||
public ILogger<AdminDbMigrationService> Logger { get; set; }
|
||||
|
||||
public async Task MigrateAsync()
|
||||
{
|
||||
var initialMigrationAdded = AddInitialMigrationIfNotExist();
|
||||
@ -52,7 +53,7 @@ public class AdminDbMigrationService : ITransientDependency
|
||||
await MigrateDatabaseSchemaAsync();
|
||||
await SeedDataAsync();
|
||||
|
||||
Logger.LogInformation($"Successfully completed host database migrations.");
|
||||
Logger.LogInformation("Successfully completed host database migrations.");
|
||||
|
||||
var tenants = await _tenantRepository.GetListAsync(includeDetails: true);
|
||||
|
||||
@ -101,8 +102,10 @@ public class AdminDbMigrationService : ITransientDependency
|
||||
Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed...");
|
||||
|
||||
await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id)
|
||||
.WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue)
|
||||
.WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue)
|
||||
.WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName,
|
||||
IdentityDataSeedContributor.AdminEmailDefaultValue)
|
||||
.WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName,
|
||||
IdentityDataSeedContributor.AdminPasswordDefaultValue)
|
||||
);
|
||||
}
|
||||
|
||||
@ -127,10 +130,8 @@ public class AdminDbMigrationService : ITransientDependency
|
||||
AddInitialMigration();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -149,7 +150,8 @@ public class AdminDbMigrationService : ITransientDependency
|
||||
private bool MigrationsFolderExists()
|
||||
{
|
||||
var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath();
|
||||
return dbMigrationsProjectFolder != null && Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations"));
|
||||
return dbMigrationsProjectFolder != null &&
|
||||
Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations"));
|
||||
}
|
||||
|
||||
private void AddInitialMigration()
|
||||
@ -207,7 +209,8 @@ public class AdminDbMigrationService : ITransientDependency
|
||||
{
|
||||
currentDirectory = Directory.GetParent(currentDirectory.FullName);
|
||||
|
||||
if (currentDirectory != null && Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null)
|
||||
if (currentDirectory != null &&
|
||||
Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null)
|
||||
{
|
||||
return currentDirectory.FullName;
|
||||
}
|
||||
@ -215,4 +218,4 @@ public class AdminDbMigrationService : ITransientDependency
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,4 +5,4 @@ namespace KonSoft.Admin.Data;
|
||||
public interface IAdminDbSchemaMigrator
|
||||
{
|
||||
Task MigrateAsync();
|
||||
}
|
||||
}
|
||||
@ -12,4 +12,4 @@ public class NullAdminDbSchemaMigrator : IAdminDbSchemaMigrator, ITransientDepen
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,60 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
using System.Collections.Generic;
|
||||
using Volo.Abp.Domain.Values;
|
||||
|
||||
namespace KonSoft.Admin.Entities
|
||||
namespace KonSoft.Admin.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public class AddressInfo : ValueObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public class AddressInfo : ValueObject
|
||||
public AddressInfo()
|
||||
{
|
||||
/// <summary>
|
||||
/// 联系人
|
||||
/// </summary>
|
||||
public string ContactName { get; private set; }
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
public string ContactPhone { get; private set; }
|
||||
/// <summary>
|
||||
/// 详细地址
|
||||
/// </summary>
|
||||
public string DetailAddress { get; private set; }
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string City { get; private set; }
|
||||
/// <summary>
|
||||
/// 区域
|
||||
/// </summary>
|
||||
public string District { get; private set; }
|
||||
|
||||
|
||||
public AddressInfo() { }
|
||||
|
||||
public AddressInfo(string contactName, string contactPhone, string detailAddress, string city, string district)
|
||||
{
|
||||
ContactName = contactName;
|
||||
ContactPhone = contactPhone;
|
||||
DetailAddress = detailAddress;
|
||||
City = city;
|
||||
District = district;
|
||||
}
|
||||
|
||||
|
||||
protected override IEnumerable<object> GetAtomicValues()
|
||||
{
|
||||
yield return ContactName;
|
||||
yield return ContactPhone;
|
||||
yield return DetailAddress;
|
||||
yield return City;
|
||||
yield return District;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public AddressInfo(string contactName, string contactPhone, string detailAddress, string city, string district)
|
||||
{
|
||||
ContactName = contactName;
|
||||
ContactPhone = contactPhone;
|
||||
DetailAddress = detailAddress;
|
||||
City = city;
|
||||
District = district;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 联系人
|
||||
/// </summary>
|
||||
public string ContactName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
public string ContactPhone { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 详细地址
|
||||
/// </summary>
|
||||
public string DetailAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string City { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 区域
|
||||
/// </summary>
|
||||
public string District { get; }
|
||||
|
||||
|
||||
protected override IEnumerable<object> GetAtomicValues()
|
||||
{
|
||||
yield return ContactName;
|
||||
yield return ContactPhone;
|
||||
yield return DetailAddress;
|
||||
yield return City;
|
||||
yield return District;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
using Volo.Abp.Identity;
|
||||
|
||||
namespace KonSoft.Admin.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 家政服务工人实体
|
||||
/// </summary>
|
||||
public class HouseholdWorker : IdentityUser
|
||||
{
|
||||
/// <summary>
|
||||
/// 接单数
|
||||
/// </summary>
|
||||
public int OrderCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职业
|
||||
/// </summary>
|
||||
public required string Profession { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 能力范围
|
||||
/// </summary>
|
||||
public required string ScopeOfCompetence { get; set; }
|
||||
}
|
||||
@ -1,157 +1,171 @@
|
||||
using KonSoft.Admin.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using KonSoft.Admin.Enums;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
using Volo.Abp.Identity;
|
||||
|
||||
namespace KonSoft.Admin.Entities
|
||||
namespace KonSoft.Admin.Entities;
|
||||
|
||||
public class Order : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public class Order : FullAuditedAggregateRoot<Guid>
|
||||
protected Order()
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单编号
|
||||
/// </summary>
|
||||
public string OrderSN { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public Guid CustomerId { get; private set; }
|
||||
/// <summary>
|
||||
/// 家政人员ID
|
||||
/// </summary>
|
||||
public Guid? WorkerId { get; private set; }
|
||||
|
||||
///// <summary>
|
||||
///// 用户ID
|
||||
///// </summary>
|
||||
//public virtual IdentityUser Customer { get; private set; }
|
||||
///// <summary>
|
||||
///// 家政人员ID
|
||||
///// </summary>
|
||||
//public virtual IdentityUser? Worker { get; private set; }
|
||||
/// <summary>
|
||||
/// 服务项目ID
|
||||
/// </summary>
|
||||
public Guid ServiceCategoryId { get; private set; }
|
||||
|
||||
public virtual ServiceCategory ServiceCategory { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务预约时间
|
||||
/// </summary>
|
||||
public DateTime ServiceTime { get; private set; }
|
||||
|
||||
public OrderStatus Status { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应付金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; private set; }
|
||||
/// <summary>
|
||||
/// 实付金额
|
||||
/// </summary>
|
||||
public decimal PaidAmount { get; private set; }
|
||||
/// <summary>
|
||||
/// 支付方式
|
||||
/// </summary>
|
||||
public string PaymentMethod { get; private set; }
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public AddressInfo Address { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remark { get; private set; }
|
||||
/// <summary>
|
||||
/// 取消原因
|
||||
/// </summary>
|
||||
public string? CancelReason { get; private set; }
|
||||
|
||||
protected Order() { }
|
||||
|
||||
|
||||
public Order(Guid id, string orderSN, Guid customerId, Guid serviceCategoryId, DateTime serviceTime, decimal amount, AddressInfo address, string remark = null)
|
||||
: base(id)
|
||||
{
|
||||
OrderSN = orderSN;
|
||||
CustomerId = customerId;
|
||||
ServiceCategoryId = serviceCategoryId;
|
||||
ServiceTime = serviceTime;
|
||||
Amount = amount;
|
||||
Address = address;
|
||||
Remark = remark;
|
||||
Status = OrderStatus.PendingPayment;
|
||||
}
|
||||
|
||||
|
||||
public void MarkPaid(decimal paidAmount, string method)
|
||||
{
|
||||
if (Status != OrderStatus.PendingPayment)
|
||||
throw new InvalidOperationException("订单不在待付款状态");
|
||||
|
||||
|
||||
PaidAmount = paidAmount;
|
||||
PaymentMethod = method;
|
||||
Status = OrderStatus.PaidWaitingAssign;
|
||||
}
|
||||
|
||||
|
||||
public void AssignWorker(Guid workerId)
|
||||
{
|
||||
if (Status != OrderStatus.PaidWaitingAssign)
|
||||
throw new InvalidOperationException("订单无法分配师傅");
|
||||
|
||||
|
||||
WorkerId = workerId;
|
||||
Status = OrderStatus.AssignedWaitingService;
|
||||
}
|
||||
|
||||
|
||||
public void StartService()
|
||||
{
|
||||
if (Status != OrderStatus.AssignedWaitingService)
|
||||
throw new InvalidOperationException("订单无法开始");
|
||||
|
||||
|
||||
Status = OrderStatus.InService;
|
||||
}
|
||||
|
||||
|
||||
public void CompleteService()
|
||||
{
|
||||
if (Status != OrderStatus.InService)
|
||||
throw new InvalidOperationException("订单未开始服务,无法完成");
|
||||
|
||||
|
||||
Status = OrderStatus.WaitingConfirm;
|
||||
}
|
||||
|
||||
|
||||
public void ConfirmCompletion()
|
||||
{
|
||||
if (Status != OrderStatus.WaitingConfirm)
|
||||
throw new InvalidOperationException("订单无法确认");
|
||||
|
||||
|
||||
Status = OrderStatus.Completed;
|
||||
}
|
||||
|
||||
|
||||
public void Cancel(string reason)
|
||||
{
|
||||
// 若已完成或退款中则不可取消
|
||||
if (Status == OrderStatus.Completed || Status == OrderStatus.Refunding || Status == OrderStatus.Refunded)
|
||||
throw new InvalidOperationException("订单无法被取消");
|
||||
|
||||
|
||||
CancelReason = reason;
|
||||
Status = OrderStatus.Canceled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Order(Guid id, string orderSN, Guid customerId, Guid serviceCategoryId, DateTime serviceTime, decimal amount,
|
||||
AddressInfo address, string remark = null)
|
||||
: base(id)
|
||||
{
|
||||
OrderSN = orderSN;
|
||||
CustomerId = customerId;
|
||||
ServiceCategoryId = serviceCategoryId;
|
||||
ServiceTime = serviceTime;
|
||||
Amount = amount;
|
||||
Address = address;
|
||||
Remark = remark;
|
||||
Status = OrderStatus.PendingPayment;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单编号
|
||||
/// </summary>
|
||||
public string OrderSN { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public Guid CustomerId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 家政人员ID
|
||||
/// </summary>
|
||||
public Guid? WorkerId { get; private set; }
|
||||
|
||||
///// <summary>
|
||||
///// 用户ID
|
||||
///// </summary>
|
||||
//public virtual IdentityUser Customer { get; private set; }
|
||||
///// <summary>
|
||||
///// 家政人员ID
|
||||
///// </summary>
|
||||
//public virtual IdentityUser? Worker { get; private set; }
|
||||
/// <summary>
|
||||
/// 服务项目ID
|
||||
/// </summary>
|
||||
public Guid ServiceCategoryId { get; private set; }
|
||||
|
||||
public virtual ServiceCategory ServiceCategory { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务预约时间
|
||||
/// </summary>
|
||||
public DateTime ServiceTime { get; private set; }
|
||||
|
||||
public OrderStatus Status { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应付金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实付金额
|
||||
/// </summary>
|
||||
public decimal PaidAmount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付方式
|
||||
/// </summary>
|
||||
public string PaymentMethod { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public AddressInfo Address { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remark { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 取消原因
|
||||
/// </summary>
|
||||
public string? CancelReason { get; private set; }
|
||||
|
||||
|
||||
public void MarkPaid(decimal paidAmount, string method)
|
||||
{
|
||||
if (Status != OrderStatus.PendingPayment)
|
||||
{
|
||||
throw new InvalidOperationException("订单不在待付款状态");
|
||||
}
|
||||
|
||||
|
||||
PaidAmount = paidAmount;
|
||||
PaymentMethod = method;
|
||||
Status = OrderStatus.PaidWaitingAssign;
|
||||
}
|
||||
|
||||
|
||||
public void AssignWorker(Guid workerId)
|
||||
{
|
||||
if (Status != OrderStatus.PaidWaitingAssign)
|
||||
{
|
||||
throw new InvalidOperationException("订单无法分配师傅");
|
||||
}
|
||||
|
||||
|
||||
WorkerId = workerId;
|
||||
Status = OrderStatus.AssignedWaitingService;
|
||||
}
|
||||
|
||||
|
||||
public void StartService()
|
||||
{
|
||||
if (Status != OrderStatus.AssignedWaitingService)
|
||||
{
|
||||
throw new InvalidOperationException("订单无法开始");
|
||||
}
|
||||
|
||||
|
||||
Status = OrderStatus.InService;
|
||||
}
|
||||
|
||||
|
||||
public void CompleteService()
|
||||
{
|
||||
if (Status != OrderStatus.InService)
|
||||
{
|
||||
throw new InvalidOperationException("订单未开始服务,无法完成");
|
||||
}
|
||||
|
||||
|
||||
Status = OrderStatus.WaitingConfirm;
|
||||
}
|
||||
|
||||
|
||||
public void ConfirmCompletion()
|
||||
{
|
||||
if (Status != OrderStatus.WaitingConfirm)
|
||||
{
|
||||
throw new InvalidOperationException("订单无法确认");
|
||||
}
|
||||
|
||||
|
||||
Status = OrderStatus.Completed;
|
||||
}
|
||||
|
||||
|
||||
public void Cancel(string reason)
|
||||
{
|
||||
// 若已完成或退款中则不可取消
|
||||
if (Status == OrderStatus.Completed || Status == OrderStatus.Refunding || Status == OrderStatus.Refunded)
|
||||
{
|
||||
throw new InvalidOperationException("订单无法被取消");
|
||||
}
|
||||
|
||||
|
||||
CancelReason = reason;
|
||||
Status = OrderStatus.Canceled;
|
||||
}
|
||||
}
|
||||
@ -1,99 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace KonSoft.Admin.Entities
|
||||
namespace KonSoft.Admin.Entities;
|
||||
|
||||
public class Product(
|
||||
Guid id,
|
||||
string name,
|
||||
string code,
|
||||
decimal price,
|
||||
string description,
|
||||
string type,
|
||||
Guid? parentId,
|
||||
string status = "在售",
|
||||
int order = 0) : FullAuditedAggregateRoot<Guid>(id)
|
||||
{
|
||||
public class Product(Guid id, string name, string code, decimal price, string description, string type, Guid? parentId, string status = "在售", int order = 0) : FullAuditedAggregateRoot<Guid>(id)
|
||||
/// <summary>
|
||||
/// 分类名称
|
||||
/// </summary>
|
||||
public string Name { get; private set; } = name;
|
||||
|
||||
/// <summary>
|
||||
/// 商品编码
|
||||
/// </summary>
|
||||
public string Code { get; private set; } = code;
|
||||
|
||||
/// <summary>
|
||||
/// 商品价格
|
||||
/// </summary>
|
||||
public decimal Price { get; private set; } = price;
|
||||
|
||||
/// <summary>
|
||||
/// 商品描述
|
||||
/// </summary>
|
||||
public string Description { get; private set; } = description;
|
||||
|
||||
/// <summary>
|
||||
/// 分类类型(大类或小类)
|
||||
/// </summary>
|
||||
public string Type { get; private set; } = type;
|
||||
|
||||
/// <summary>
|
||||
/// 父分类ID
|
||||
/// </summary>
|
||||
public Guid? ParentId { get; private set; } = parentId;
|
||||
|
||||
/// <summary>
|
||||
/// 商品状态(在售/下架等)
|
||||
/// </summary>
|
||||
public string Status { get; private set; } = status;
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public int Order { get; private set; } = order;
|
||||
|
||||
[NotMapped] public List<Product> Children { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 修改商品信息
|
||||
/// </summary>
|
||||
public void Update(string name, string code, decimal price, string description, int order)
|
||||
{
|
||||
/// <summary>
|
||||
/// 分类名称
|
||||
/// </summary>
|
||||
public string Name { get; private set; } = name;
|
||||
Name = name;
|
||||
Code = code;
|
||||
Price = price;
|
||||
Description = description;
|
||||
Order = order;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品编码
|
||||
/// </summary>
|
||||
public string Code { get; private set; } = code;
|
||||
/// <summary>
|
||||
/// 修改商品分类
|
||||
/// </summary>
|
||||
public void ChangeCategory(string type, Guid? parentId)
|
||||
{
|
||||
Type = type;
|
||||
ParentId = parentId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品价格
|
||||
/// </summary>
|
||||
public decimal Price { get; private set; } = price;
|
||||
/// <summary>
|
||||
/// 上架商品
|
||||
/// </summary>
|
||||
public void PutOnSale()
|
||||
{
|
||||
Status = "在售";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品描述
|
||||
/// </summary>
|
||||
public string Description { get; private set; } = description;
|
||||
/// <summary>
|
||||
/// 下架商品
|
||||
/// </summary>
|
||||
public void TakeOffSale()
|
||||
{
|
||||
Status = "下架";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分类类型(大类或小类)
|
||||
/// </summary>
|
||||
public string Type { get; private set; } = type;
|
||||
|
||||
/// <summary>
|
||||
/// 父分类ID
|
||||
/// </summary>
|
||||
public Guid? ParentId { get; private set; } = parentId;
|
||||
|
||||
/// <summary>
|
||||
/// 商品状态(在售/下架等)
|
||||
/// </summary>
|
||||
public string Status { get; private set; } = status;
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public int Order { get; private set; } = order;
|
||||
|
||||
[NotMapped]
|
||||
public List<Product> Children { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 修改商品信息
|
||||
/// </summary>
|
||||
public void Update(string name, string code, decimal price, string description, int order)
|
||||
{
|
||||
Name = name;
|
||||
Code = code;
|
||||
Price = price;
|
||||
Description = description;
|
||||
Order = order;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改商品分类
|
||||
/// </summary>
|
||||
public void ChangeCategory(string type, Guid? parentId)
|
||||
{
|
||||
Type = type;
|
||||
ParentId = parentId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上架商品
|
||||
/// </summary>
|
||||
public void PutOnSale()
|
||||
{
|
||||
Status = "在售";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下架商品
|
||||
/// </summary>
|
||||
public void TakeOffSale()
|
||||
{
|
||||
Status = "下架";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改价格
|
||||
/// </summary>
|
||||
public void ChangePrice(decimal newPrice)
|
||||
{
|
||||
Price = newPrice;
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改价格
|
||||
/// </summary>
|
||||
public void ChangePrice(decimal newPrice)
|
||||
{
|
||||
Price = newPrice;
|
||||
}
|
||||
}
|
||||
@ -1,46 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace KonSoft.Admin.Entities
|
||||
namespace KonSoft.Admin.Entities;
|
||||
|
||||
public class ServiceCategory : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public class ServiceCategory : FullAuditedAggregateRoot<Guid>
|
||||
protected ServiceCategory()
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public Guid? ParentId { get; private set; }
|
||||
public string Path { get; private set; }
|
||||
public int Level { get; private set; }
|
||||
|
||||
protected ServiceCategory() { }
|
||||
|
||||
public ServiceCategory(Guid id, string name)
|
||||
: base(id)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public ServiceCategory(Guid id, string name, Guid? parentId = null, string path = null, int level = 0) : base(id)
|
||||
{
|
||||
Name = name;
|
||||
ParentId = parentId;
|
||||
Path = path ?? id.ToString();
|
||||
Level = level;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateName(string name) => Name = name;
|
||||
|
||||
|
||||
public void SetParent(ServiceCategory parent)
|
||||
{
|
||||
ParentId = parent?.Id;
|
||||
Level = (parent?.Level ?? 0) + 1;
|
||||
Path = parent != null ? $"{parent.Path}/{Id}" : Id.ToString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public ServiceCategory(Guid id, string name)
|
||||
: base(id)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public ServiceCategory(Guid id, string name, Guid? parentId = null, string path = null, int level = 0) : base(id)
|
||||
{
|
||||
Name = name;
|
||||
ParentId = parentId;
|
||||
Path = path ?? id.ToString();
|
||||
Level = level;
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public Guid? ParentId { get; private set; }
|
||||
public string Path { get; private set; }
|
||||
public int Level { get; private set; }
|
||||
|
||||
|
||||
public void UpdateName(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
|
||||
public void SetParent(ServiceCategory parent)
|
||||
{
|
||||
ParentId = parent?.Id;
|
||||
Level = (parent?.Level ?? 0) + 1;
|
||||
Path = parent != null ? $"{parent.Path}/{Id}" : Id.ToString();
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
using KonSoft.Admin.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace KonSoft.Admin.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 家政人员
|
||||
/// </summary>
|
||||
public class Worker : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string Phone { get; private set; }
|
||||
public decimal Rating { get; private set; } // 评分
|
||||
public List<Guid> SkillCategoryIds { get; private set; } = new List<Guid>();
|
||||
|
||||
public Worker() { }
|
||||
|
||||
|
||||
public void UpdateRating(decimal newRating)
|
||||
{
|
||||
Rating = newRating;
|
||||
}
|
||||
|
||||
public bool CanPerform(Guid serviceCategoryId)
|
||||
{
|
||||
return SkillCategoryIds.Contains(serviceCategoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
using KonSoft.Admin.Entities;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.IRepositories;
|
||||
|
||||
public interface IHouseholdWorkerRepository : IRepository<HouseholdWorker>
|
||||
{
|
||||
}
|
||||
@ -1,14 +1,8 @@
|
||||
using KonSoft.Admin.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.Repositories
|
||||
namespace KonSoft.Admin.IRepositories;
|
||||
|
||||
public interface IOrderRepository : IRepository<Order>
|
||||
{
|
||||
public interface IOrderRepository : IRepository<Order>
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,13 @@
|
||||
using KonSoft.Admin.Entities;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Entities;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace KonSoft.Admin.Repositories
|
||||
namespace KonSoft.Admin.IRepositories;
|
||||
|
||||
public interface IProductRepository : IRepository<Product>
|
||||
{
|
||||
public interface IProductRepository : IRepository<Product>
|
||||
{
|
||||
Task<List<Product>> GetPageRootListAsync(int skipCount, int maxResult, Expression<Func<Product, bool>> where);
|
||||
}
|
||||
}
|
||||
Task<List<Product>> GetPageRootListAsync(int skipCount, int maxResult, Expression<Func<Product, bool>> where);
|
||||
}
|
||||
@ -23,12 +23,12 @@ namespace KonSoft.Admin.OpenIddict;
|
||||
*/
|
||||
public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDependency
|
||||
{
|
||||
private readonly IAbpApplicationManager _applicationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository;
|
||||
private readonly IAbpApplicationManager _applicationManager;
|
||||
private readonly IOpenIddictScopeRepository _openIddictScopeRepository;
|
||||
private readonly IOpenIddictScopeManager _scopeManager;
|
||||
private readonly IPermissionDataSeeder _permissionDataSeeder;
|
||||
private readonly IOpenIddictScopeManager _scopeManager;
|
||||
private readonly IStringLocalizer<OpenIddictResponse> L;
|
||||
|
||||
public OpenIddictDataSeedContributor(
|
||||
@ -38,7 +38,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
IOpenIddictScopeRepository openIddictScopeRepository,
|
||||
IOpenIddictScopeManager scopeManager,
|
||||
IPermissionDataSeeder permissionDataSeeder,
|
||||
IStringLocalizer<OpenIddictResponse> l )
|
||||
IStringLocalizer<OpenIddictResponse> l)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_openIddictApplicationRepository = openIddictApplicationRepository;
|
||||
@ -60,7 +60,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
{
|
||||
if (await _openIddictScopeRepository.FindByNameAsync("Admin") == null)
|
||||
{
|
||||
await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor {
|
||||
await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor
|
||||
{
|
||||
Name = "Admin", DisplayName = "Admin API", Resources = { "Admin" }
|
||||
});
|
||||
}
|
||||
@ -68,7 +69,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
|
||||
private async Task CreateApplicationsAsync()
|
||||
{
|
||||
var commonScopes = new List<string> {
|
||||
var commonScopes = new List<string>
|
||||
{
|
||||
OpenIddictConstants.Permissions.Scopes.Address,
|
||||
OpenIddictConstants.Permissions.Scopes.Email,
|
||||
OpenIddictConstants.Permissions.Scopes.Phone,
|
||||
@ -80,10 +82,6 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
var configurationSection = _configuration.GetSection("OpenIddict:Applications");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Swagger Client
|
||||
var swaggerClientId = configurationSection["Admin_Swagger:ClientId"];
|
||||
if (!swaggerClientId.IsNullOrWhiteSpace())
|
||||
@ -91,13 +89,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
var swaggerRootUrl = configurationSection["Admin_Swagger:RootUrl"]?.TrimEnd('/');
|
||||
|
||||
await CreateApplicationAsync(
|
||||
name: swaggerClientId!,
|
||||
type: OpenIddictConstants.ClientTypes.Public,
|
||||
consentType: OpenIddictConstants.ConsentTypes.Implicit,
|
||||
displayName: "Swagger Application",
|
||||
secret: null,
|
||||
grantTypes: [OpenIddictConstants.GrantTypes.AuthorizationCode],
|
||||
scopes: commonScopes,
|
||||
swaggerClientId!,
|
||||
OpenIddictConstants.ClientTypes.Public,
|
||||
OpenIddictConstants.ConsentTypes.Implicit,
|
||||
"Swagger Application",
|
||||
null,
|
||||
[OpenIddictConstants.GrantTypes.AuthorizationCode],
|
||||
commonScopes,
|
||||
redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html",
|
||||
clientUri: swaggerRootUrl
|
||||
);
|
||||
@ -131,13 +129,14 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
|
||||
var client = await _openIddictApplicationRepository.FindByClientIdAsync(name);
|
||||
|
||||
var application = new AbpApplicationDescriptor {
|
||||
var application = new AbpApplicationDescriptor
|
||||
{
|
||||
ClientId = name,
|
||||
ClientType = type,
|
||||
ClientSecret = secret,
|
||||
ConsentType = consentType,
|
||||
DisplayName = displayName,
|
||||
ClientUri = clientUri,
|
||||
ClientUri = clientUri
|
||||
};
|
||||
|
||||
Check.NotNullOrEmpty(grantTypes, nameof(grantTypes));
|
||||
@ -160,7 +159,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout);
|
||||
}
|
||||
|
||||
var buildInGrantTypes = new[] {
|
||||
var buildInGrantTypes = new[]
|
||||
{
|
||||
OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password,
|
||||
OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials,
|
||||
OpenIddictConstants.GrantTypes.DeviceCode, OpenIddictConstants.GrantTypes.RefreshToken
|
||||
@ -233,7 +233,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
}
|
||||
}
|
||||
|
||||
var buildInScopes = new[] {
|
||||
var buildInScopes = new[]
|
||||
{
|
||||
OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email,
|
||||
OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile,
|
||||
OpenIddictConstants.Permissions.Scopes.Roles
|
||||
@ -289,8 +290,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
await _permissionDataSeeder.SeedAsync(
|
||||
ClientPermissionValueProvider.ProviderName,
|
||||
name,
|
||||
permissions,
|
||||
null
|
||||
permissions
|
||||
);
|
||||
}
|
||||
|
||||
@ -302,8 +302,10 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
|
||||
if (!HasSameRedirectUris(client, application))
|
||||
{
|
||||
client.RedirectUris = JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
||||
client.PostLogoutRedirectUris = JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
||||
client.RedirectUris =
|
||||
JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
||||
client.PostLogoutRedirectUris =
|
||||
JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
||||
|
||||
await _applicationManager.UpdateAsync(client.ToModel());
|
||||
}
|
||||
@ -317,11 +319,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
||||
|
||||
private bool HasSameRedirectUris(OpenIddictApplication existingClient, AbpApplicationDescriptor application)
|
||||
{
|
||||
return existingClient.RedirectUris == JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
||||
return existingClient.RedirectUris ==
|
||||
JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
||||
}
|
||||
|
||||
private bool HasSameScopes(OpenIddictApplication existingClient, AbpApplicationDescriptor application)
|
||||
{
|
||||
return existingClient.Permissions == JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/')));
|
||||
return existingClient.Permissions ==
|
||||
JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/')));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
[assembly:InternalsVisibleToAttribute("KonSoft.Admin.Domain.Tests")]
|
||||
[assembly:InternalsVisibleToAttribute("KonSoft.Admin.TestBase")]
|
||||
|
||||
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Domain.Tests")]
|
||||
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.TestBase")]
|
||||
@ -9,4 +9,4 @@ public class AdminSettingDefinitionProvider : SettingDefinitionProvider
|
||||
//Define your own settings here. Example:
|
||||
//context.Add(new SettingDefinition(AdminSettings.MySetting1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,4 +6,4 @@ public static class AdminSettings
|
||||
|
||||
//Add your own setting names here. Example:
|
||||
//public const string MySetting1 = Prefix + ".MySetting1";
|
||||
}
|
||||
}
|
||||
@ -24,54 +24,15 @@ public class AdminDbContext :
|
||||
IIdentityDbContext,
|
||||
ITenantManagementDbContext
|
||||
{
|
||||
/* Add DbSet properties for your Aggregate Roots / Entities here. */
|
||||
|
||||
#region Entities from the modules
|
||||
|
||||
/* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext
|
||||
* and replaced them for this DbContext. This allows you to perform JOIN
|
||||
* queries for the entities of these modules over the repositories easily. You
|
||||
* typically don't need that for other modules. But, if you need, you can
|
||||
* implement the DbContext interface of the needed module and use ReplaceDbContext
|
||||
* attribute just like IIdentityDbContext and ITenantManagementDbContext.
|
||||
*
|
||||
* More info: Replacing a DbContext of a module ensures that the related module
|
||||
* uses this DbContext on runtime. Otherwise, it will use its own DbContext class.
|
||||
*/
|
||||
|
||||
//Identity
|
||||
public DbSet<IdentityUser> Users { get; set; }
|
||||
public DbSet<IdentityRole> Roles { get; set; }
|
||||
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
|
||||
public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
|
||||
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
|
||||
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
|
||||
public DbSet<IdentityUserDelegation> UserDelegations { get; set; }
|
||||
public DbSet<IdentitySession> Sessions { get; set; }
|
||||
// Tenant Management
|
||||
public DbSet<Tenant> Tenants { get; set; }
|
||||
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 订单
|
||||
public DbSet<Order> Orders { get; set; }
|
||||
public DbSet<Worker> Workers { get; set; }
|
||||
public DbSet<ServiceCategory> ServiceCategorys { get; set; }
|
||||
#endregion
|
||||
|
||||
public AdminDbContext(DbContextOptions<AdminDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
/* Include modules to your migration db context */
|
||||
|
||||
builder.ConfigurePermissionManagement();
|
||||
builder.ConfigureSettingManagement();
|
||||
builder.ConfigureBackgroundJobs();
|
||||
@ -80,14 +41,24 @@ public class AdminDbContext :
|
||||
builder.ConfigureOpenIddict();
|
||||
builder.ConfigureFeatureManagement();
|
||||
builder.ConfigureTenantManagement();
|
||||
|
||||
/* Configure your own tables/entities inside here */
|
||||
|
||||
//builder.Entity<YourEntity>(b =>
|
||||
//{
|
||||
// b.ToTable(AdminConsts.DbTablePrefix + "YourEntities", AdminConsts.DbSchema);
|
||||
// b.ConfigureByConvention(); //auto configure for the base class props
|
||||
// //...
|
||||
//});
|
||||
}
|
||||
}
|
||||
|
||||
public DbSet<IdentityUser> Users { get; set; }
|
||||
public DbSet<IdentityRole> Roles { get; set; }
|
||||
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
|
||||
public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
|
||||
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
|
||||
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
|
||||
public DbSet<IdentityUserDelegation> UserDelegations { get; set; }
|
||||
|
||||
public DbSet<IdentitySession> Sessions { get; set; }
|
||||
|
||||
public DbSet<Tenant> Tenants { get; set; }
|
||||
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
|
||||
|
||||
|
||||
public DbSet<Order> Orders { get; set; }
|
||||
public DbSet<ServiceCategory> ServiceCategories { get; set; }
|
||||
public DbSet<HouseholdWorker> HouseholdWorkers { get; set; }
|
||||
|
||||
}
|
||||
@ -29,8 +29,8 @@ public class AdminDbContextFactory : IDesignTimeDbContextFactory<AdminDbContext>
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../KonSoft.Admin.DbMigrator/"))
|
||||
.AddJsonFile("appsettings.json", optional: false);
|
||||
.AddJsonFile("appsettings.json", false);
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.ObjectExtending;
|
||||
using Volo.Abp.Threading;
|
||||
using Volo.Abp.Threading;
|
||||
|
||||
namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
|
||||
public static class AdminEfCoreEntityExtensionMappings
|
||||
{
|
||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
||||
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
@ -16,29 +13,29 @@ public static class AdminEfCoreEntityExtensionMappings
|
||||
|
||||
OneTimeRunner.Run(() =>
|
||||
{
|
||||
/* You can configure extra properties for the
|
||||
* entities defined in the modules used by your application.
|
||||
*
|
||||
* This class can be used to map these extra properties to table fields in the database.
|
||||
*
|
||||
* USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING.
|
||||
* USE AdminModuleExtensionConfigurator CLASS (in the Domain.Shared project)
|
||||
* FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES
|
||||
*
|
||||
* Example: Map a property to a table field:
|
||||
/* You can configure extra properties for the
|
||||
* entities defined in the modules used by your application.
|
||||
*
|
||||
* This class can be used to map these extra properties to table fields in the database.
|
||||
*
|
||||
* USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING.
|
||||
* USE AdminModuleExtensionConfigurator CLASS (in the Domain.Shared project)
|
||||
* FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES
|
||||
*
|
||||
* Example: Map a property to a table field:
|
||||
|
||||
ObjectExtensionManager.Instance
|
||||
.MapEfCoreProperty<IdentityUser, string>(
|
||||
"MyProperty",
|
||||
(entityBuilder, propertyBuilder) =>
|
||||
{
|
||||
propertyBuilder.HasMaxLength(128);
|
||||
}
|
||||
);
|
||||
ObjectExtensionManager.Instance
|
||||
.MapEfCoreProperty<IdentityUser, string>(
|
||||
"MyProperty",
|
||||
(entityBuilder, propertyBuilder) =>
|
||||
{
|
||||
propertyBuilder.HasMaxLength(128);
|
||||
}
|
||||
);
|
||||
|
||||
* See the documentation for more:
|
||||
* https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
|
||||
*/
|
||||
* See the documentation for more:
|
||||
* https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
|
||||
*/
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp.Uow;
|
||||
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
||||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
|
||||
using Volo.Abp.EntityFrameworkCore;
|
||||
@ -26,7 +25,7 @@ namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
|
||||
typeof(AbpTenantManagementEntityFrameworkCoreModule),
|
||||
typeof(AbpFeatureManagementEntityFrameworkCoreModule)
|
||||
)]
|
||||
)]
|
||||
public class AdminEntityFrameworkCoreModule : AbpModule
|
||||
{
|
||||
public override void PreConfigureServices(ServiceConfigurationContext context)
|
||||
@ -41,17 +40,16 @@ public class AdminEntityFrameworkCoreModule : AbpModule
|
||||
{
|
||||
context.Services.AddAbpDbContext<AdminDbContext>(options =>
|
||||
{
|
||||
/* Remove "includeAllEntities: true" to create
|
||||
* default repositories only for aggregate roots */
|
||||
options.AddDefaultRepositories(includeAllEntities: true);
|
||||
/* Remove "includeAllEntities: true" to create
|
||||
* default repositories only for aggregate roots */
|
||||
options.AddDefaultRepositories(true);
|
||||
});
|
||||
|
||||
Configure<AbpDbContextOptions>(options =>
|
||||
{
|
||||
/* The main point to change your DBMS.
|
||||
* See also AdminMigrationsDbContextFactory for EF Core tooling. */
|
||||
/* The main point to change your DBMS.
|
||||
* See also AdminMigrationsDbContextFactory for EF Core tooling. */
|
||||
options.UseNpgsql();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,52 +1,34 @@
|
||||
using KonSoft.Admin.Entities;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using KonSoft.Admin.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp;
|
||||
|
||||
namespace KonSoft.Admin.EntityFrameworkCore.Configures
|
||||
namespace KonSoft.Admin.EntityFrameworkCore.Configures;
|
||||
|
||||
public static class ApplicationDbContextModelBuilderExtensions
|
||||
{
|
||||
public static class ApplicationDbContextModelBuilderExtensions
|
||||
public static void ConfigureApplication([NotNull] this ModelBuilder builder)
|
||||
{
|
||||
public static void ConfigureApplication([NotNull] this ModelBuilder builder)
|
||||
Check.NotNull(builder, nameof(builder));
|
||||
|
||||
builder.Entity<Order>(b =>
|
||||
{
|
||||
Check.NotNull(builder, nameof(builder));
|
||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(Order) + AdminConsts.DbSchema);
|
||||
|
||||
builder.Entity<Order>(b =>
|
||||
b.OwnsOne(o => o.Address, a =>
|
||||
{
|
||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(Order) + AdminConsts.DbSchema);
|
||||
|
||||
b.OwnsOne(o => o.Address, a =>
|
||||
{
|
||||
a.Property(p => p.ContactName).HasColumnName("ContactName").HasMaxLength(50);
|
||||
a.Property(p => p.ContactPhone).HasColumnName("ContactPhone").HasMaxLength(20);
|
||||
a.Property(p => p.DetailAddress).HasColumnName("DetailAddress").HasMaxLength(200);
|
||||
a.Property(p => p.City).HasColumnName("City").HasMaxLength(50);
|
||||
a.Property(p => p.District).HasColumnName("District").HasMaxLength(50);
|
||||
});
|
||||
a.Property(p => p.ContactName).HasColumnName("ContactName").HasMaxLength(50);
|
||||
a.Property(p => p.ContactPhone).HasColumnName("ContactPhone").HasMaxLength(20);
|
||||
a.Property(p => p.DetailAddress).HasColumnName("DetailAddress").HasMaxLength(200);
|
||||
a.Property(p => p.City).HasColumnName("City").HasMaxLength(50);
|
||||
a.Property(p => p.District).HasColumnName("District").HasMaxLength(50);
|
||||
});
|
||||
|
||||
builder.Entity<Worker>(b =>
|
||||
{
|
||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(Worker) + AdminConsts.DbSchema);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
builder.Entity<ServiceCategory>(b =>
|
||||
{
|
||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(ServiceCategory) + AdminConsts.DbSchema);
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
builder.Entity<ServiceCategory>(b =>
|
||||
{
|
||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(ServiceCategory) + AdminConsts.DbSchema);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Admin.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using KonSoft.Admin.Data;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
@ -31,4 +31,4 @@ public class EntityFrameworkCoreAdminDbSchemaMigrator
|
||||
.Database
|
||||
.MigrateAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.IRepositories;
|
||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
||||
using Volo.Abp.EntityFrameworkCore;
|
||||
using Volo.Abp.TenantManagement.EntityFrameworkCore;
|
||||
|
||||
namespace KonSoft.Admin.EntityFrameworkCore.Repositories;
|
||||
|
||||
public class HouseholdWorkerRepository : EfCoreRepository<TenantManagementDbContext, HouseholdWorker>,
|
||||
IHouseholdWorkerRepository
|
||||
{
|
||||
public HouseholdWorkerRepository(IDbContextProvider<TenantManagementDbContext> dbContextProvider) : base(
|
||||
dbContextProvider)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,13 @@
|
||||
using KonSoft.Admin.Entities;
|
||||
using KonSoft.Admin.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using KonSoft.Admin.IRepositories;
|
||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
||||
using Volo.Abp.EntityFrameworkCore;
|
||||
|
||||
namespace KonSoft.Admin.EntityFrameworkCore.Repositories
|
||||
namespace KonSoft.Admin.EntityFrameworkCore.Repositories;
|
||||
|
||||
public class OrderRepository : EfCoreRepository<AdminDbContext, Order>, IOrderRepository
|
||||
{
|
||||
public class OrderRepository : EfCoreRepository<AdminDbContext, Order>, IOrderRepository
|
||||
public OrderRepository(IDbContextProvider<AdminDbContext> dbContextProvider) : base(dbContextProvider)
|
||||
{
|
||||
public OrderRepository(IDbContextProvider<AdminDbContext> dbContextProvider) : base(dbContextProvider)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user