Merge branch 'master' of https://git.konsoft.top/konsoft/KonSoft.Clean
This commit is contained in:
@ -20,4 +20,5 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String>
|
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String>
|
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Consts/@EntryIndexedValue">True</s:Boolean>
|
||||||
</wpf:ResourceDictionary>
|
</wpf:ResourceDictionary>
|
||||||
@ -5,6 +5,16 @@ EXPOSE 8081
|
|||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
ARG NODE_VERSION=16.13.0
|
||||||
|
ARG YARN_VERSION=1.22.15
|
||||||
|
RUN apt-get update -yq \
|
||||||
|
&& apt-get install -yq curl gnupg \
|
||||||
|
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
|
||||||
|
&& apt-get install -yq nodejs \
|
||||||
|
&& npm install -g yarn@${YARN_VERSION} \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["NuGet.Config", "."]
|
COPY ["NuGet.Config", "."]
|
||||||
COPY ["applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj", "applications/KonSoft.AuthServer/"]
|
COPY ["applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj", "applications/KonSoft.AuthServer/"]
|
||||||
@ -15,6 +25,9 @@ COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "
|
|||||||
RUN dotnet restore "./applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj"
|
RUN dotnet restore "./applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/applications/KonSoft.AuthServer"
|
WORKDIR "/src/applications/KonSoft.AuthServer"
|
||||||
|
RUN dotnet tool install -g Volo.Abp.Cli \
|
||||||
|
&& export PATH="$PATH:/root/.dotnet/tools" \
|
||||||
|
&& abp install-libs
|
||||||
RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
# 此阶段用于发布要复制到最终阶段的服务项目
|
# 此阶段用于发布要复制到最终阶段的服务项目
|
||||||
|
|||||||
@ -53,7 +53,8 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
|
|
||||||
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
|
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
|
||||||
{
|
{
|
||||||
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "59464dba-b66e-48cd-8b81-2e4a9c08c977");
|
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx",
|
||||||
|
"59464dba-b66e-48cd-8b81-2e4a9c08c977");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,10 +78,7 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
{
|
{
|
||||||
options.StyleBundles.Configure(
|
options.StyleBundles.Configure(
|
||||||
BasicThemeBundles.Styles.Global,
|
BasicThemeBundles.Styles.Global,
|
||||||
bundle =>
|
bundle => { bundle.AddFiles("/global-styles.css"); }
|
||||||
{
|
|
||||||
bundle.AddFiles("/global-styles.css");
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -90,10 +88,7 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
options.ApplicationName = "AuthServer";
|
options.ApplicationName = "AuthServer";
|
||||||
});
|
});
|
||||||
|
|
||||||
Configure<AbpBackgroundJobOptions>(options =>
|
Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; });
|
||||||
{
|
|
||||||
options.IsJobExecutionEnabled = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace KonSoft;
|
|||||||
[Dependency(ReplaceServices = true)]
|
[Dependency(ReplaceServices = true)]
|
||||||
public class KonSoftBrandingProvider : DefaultBrandingProvider
|
public class KonSoftBrandingProvider : DefaultBrandingProvider
|
||||||
{
|
{
|
||||||
private IStringLocalizer<KonSoftResource> _localizer;
|
private readonly IStringLocalizer<KonSoftResource> _localizer;
|
||||||
|
|
||||||
public KonSoftBrandingProvider(IStringLocalizer<KonSoftResource> localizer)
|
public KonSoftBrandingProvider(IStringLocalizer<KonSoftResource> localizer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
@page
|
@page
|
||||||
|
@using System.Net
|
||||||
|
@using KonSoft.Shared.Localization.Localization
|
||||||
@using Microsoft.AspNetCore.Http.Extensions
|
@using Microsoft.AspNetCore.Http.Extensions
|
||||||
@using Microsoft.AspNetCore.Mvc.Localization
|
@using Microsoft.AspNetCore.Mvc.Localization
|
||||||
@using KonSoft.Pages
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
|
||||||
@using KonSoft.Shared.Localization.Localization
|
|
||||||
@using Volo.Abp.Users
|
|
||||||
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
|
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
|
||||||
@using Volo.Abp.Ui.Branding
|
@using Volo.Abp.Ui.Branding
|
||||||
@model IndexModel
|
@using Volo.Abp.Users
|
||||||
|
@model KonSoft.Pages.IndexModel
|
||||||
@inject IHtmlLocalizer<KonSoftResource> L
|
@inject IHtmlLocalizer<KonSoftResource> L
|
||||||
@inject ICurrentUser CurrentUser
|
@inject ICurrentUser CurrentUser
|
||||||
@inject IBrandingProvider BrandingProvider
|
@inject IBrandingProvider BrandingProvider
|
||||||
@ -65,12 +66,12 @@
|
|||||||
<div class="ml-auto p-2 float-end">
|
<div class="ml-auto p-2 float-end">
|
||||||
<abp-dropdown>
|
<abp-dropdown>
|
||||||
<abp-dropdown-button text="@Model.CurrentLanguage"/>
|
<abp-dropdown-button text="@Model.CurrentLanguage"/>
|
||||||
@if (@Model.Languages != null)
|
@if (Model.Languages != null)
|
||||||
{
|
{
|
||||||
<abp-dropdown-menu>
|
<abp-dropdown-menu>
|
||||||
@foreach (var language in Model.Languages)
|
@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-item href="@languageUrl">@language.DisplayName</abp-dropdown-item>
|
||||||
}
|
}
|
||||||
</abp-dropdown-menu>
|
</abp-dropdown-menu>
|
||||||
@ -87,7 +88,7 @@
|
|||||||
<abp-row class="mt-3">
|
<abp-row class="mt-3">
|
||||||
@foreach (var application in Model.Applications)
|
@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>
|
||||||
<abp-card-body>
|
<abp-card-body>
|
||||||
@{
|
@{
|
||||||
|
|||||||
@ -9,6 +9,12 @@ namespace KonSoft.Pages;
|
|||||||
|
|
||||||
public class IndexModel : AbpPageModel
|
public class IndexModel : AbpPageModel
|
||||||
{
|
{
|
||||||
|
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
|
||||||
|
{
|
||||||
|
OpenIdApplicationRepository = openIdApplicationRepository;
|
||||||
|
LanguageProvider = languageProvider;
|
||||||
|
}
|
||||||
|
|
||||||
public List<OpenIddictApplication>? Applications { get; protected set; }
|
public List<OpenIddictApplication>? Applications { get; protected set; }
|
||||||
|
|
||||||
public IReadOnlyList<LanguageInfo>? Languages { get; protected set; }
|
public IReadOnlyList<LanguageInfo>? Languages { get; protected set; }
|
||||||
@ -19,12 +25,6 @@ public class IndexModel : AbpPageModel
|
|||||||
|
|
||||||
protected ILanguageProvider LanguageProvider { get; }
|
protected ILanguageProvider LanguageProvider { get; }
|
||||||
|
|
||||||
public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider)
|
|
||||||
{
|
|
||||||
OpenIdApplicationRepository = openIdApplicationRepository;
|
|
||||||
LanguageProvider = languageProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task OnGetAsync()
|
public async Task OnGetAsync()
|
||||||
{
|
{
|
||||||
Applications = await OpenIdApplicationRepository.GetListAsync();
|
Applications = await OpenIdApplicationRepository.GetListAsync();
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace KonSoft;
|
|||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public async static Task<int> Main(string[] args)
|
public static async Task<int> Main(string[] args)
|
||||||
{
|
{
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<location path="." inheritInChildApplications="false">
|
<location path="." inheritInChildApplications="false">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<handlers>
|
<handlers>
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
<aspNetCore processPath="dotnet" arguments=".\KonSoft.AuthServer.dll" stdoutLogEnabled="false"
|
||||||
|
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</location>
|
</location>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace KonSoft.BackgroundJobs.Controllers
|
namespace KonSoft.BackgroundJobs.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class WeatherForecastController : ControllerBase
|
public class WeatherForecastController : ControllerBase
|
||||||
@ -30,4 +30,3 @@ namespace KonSoft.BackgroundJobs.Controllers
|
|||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
namespace KonSoft.BackgroundJobs
|
namespace KonSoft.BackgroundJobs;
|
||||||
{
|
|
||||||
public class WeatherForecast
|
public class WeatherForecast
|
||||||
{
|
{
|
||||||
public DateOnly Date { get; set; }
|
public DateOnly Date { get; set; }
|
||||||
@ -10,4 +10,3 @@ namespace KonSoft.BackgroundJobs
|
|||||||
|
|
||||||
public string? Summary { get; set; }
|
public string? Summary { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace KonSoft.BackgroundWorker.Controllers
|
namespace KonSoft.BackgroundWorker.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class WeatherForecastController : ControllerBase
|
public class WeatherForecastController : ControllerBase
|
||||||
@ -30,4 +30,3 @@ namespace KonSoft.BackgroundWorker.Controllers
|
|||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
namespace KonSoft.BackgroundWorker
|
namespace KonSoft.BackgroundWorker;
|
||||||
{
|
|
||||||
public class WeatherForecast
|
public class WeatherForecast
|
||||||
{
|
{
|
||||||
public DateOnly Date { get; set; }
|
public DateOnly Date { get; set; }
|
||||||
@ -10,4 +10,3 @@ namespace KonSoft.BackgroundWorker
|
|||||||
|
|
||||||
public string? Summary { get; set; }
|
public string? Summary { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
39
docker-compose.yml
Normal file
39
docker-compose.yml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
services:
|
||||||
|
internalgateways:
|
||||||
|
container_name: clean-internalgateways
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./gateways/KonSoft.InternalGateway/Dockerfile
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Test
|
||||||
|
- AgileConfig__AppId=KonSoft.InternalGateway
|
||||||
|
- AgileConfig__Name=KonSoft.InternalGateway
|
||||||
|
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||||
|
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||||
|
|
||||||
|
authserver:
|
||||||
|
container_name: clean-authserver
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./applications/KonSoft.AuthServer/Dockerfile
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Test
|
||||||
|
- AgileConfig__AppId=KonSoft.AuthServer
|
||||||
|
- AgileConfig__Name=KonSoft.AuthServer
|
||||||
|
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||||
|
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||||
|
|
||||||
|
adminservice:
|
||||||
|
container_name: clean-adminservice
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./microservices/KonSoft.Admin.HttpApi.Host/Dockerfile
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Test
|
||||||
|
- AgileConfig__AppId=KonSoft.Admin.HttpApi.Host
|
||||||
|
- AgileConfig__Name=KonSoft.Admin.HttpApi.Host
|
||||||
|
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||||
|
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||||
@ -1,33 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace KonSoft.InternalGateway.Controllers
|
|
||||||
{
|
|
||||||
[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)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
[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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
29
gateways/KonSoft.InternalGateway/Dockerfile
Normal file
29
gateways/KonSoft.InternalGateway/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
USER $APP_UID
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["NuGet.Config", "."]
|
||||||
|
COPY ["gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj", "gateways/KonSoft.InternalGateway/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj", "shared/KonSoft.Shared.Hosting.Gateways/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj", "shared/KonSoft.Shared.Hosting.AspNetCore/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj", "shared/KonSoft.Shared.Hosting/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "shared/KonSoft.Shared.Localization/"]
|
||||||
|
RUN dotnet restore "./gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/gateways/KonSoft.InternalGateway"
|
||||||
|
RUN dotnet build "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "KonSoft.InternalGateway.dll"]
|
||||||
17
gateways/KonSoft.InternalGateway/InternalGatewayModule.cs
Normal file
17
gateways/KonSoft.InternalGateway/InternalGatewayModule.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using KonSoft.Shared.Hosting.Gateways;
|
||||||
|
using Volo.Abp;
|
||||||
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
|
namespace KonSoft.InternalGateway
|
||||||
|
{
|
||||||
|
[DependsOn(
|
||||||
|
typeof(KonSoftSharedHostingGatewaysModule)
|
||||||
|
)]
|
||||||
|
public class InternalGatewayModule : AbpModule
|
||||||
|
{
|
||||||
|
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,10 +4,18 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UserSecretsId>98521e87-fe4a-4555-8c3b-e83559a64e03</UserSecretsId>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<DockerfileContext>..\..</DockerfileContext>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||||
|
<PackageReference Include="Yarp.ReverseProxy" Version="2.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Gateways\KonSoft.Shared.Hosting.Gateways.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,25 +1,37 @@
|
|||||||
var builder = WebApplication.CreateBuilder(args);
|
using KonSoft.InternalGateway;
|
||||||
|
using KonSoft.Shared.Hosting.AspNetCore;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
// Add services to the container.
|
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||||
|
SerilogConfigurationHelper.Configure(assemblyName);
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
try
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
|
||||||
if (app.Environment.IsDevelopment())
|
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
app.UseSwaggerUI();
|
builder.Configuration
|
||||||
|
.AddAgileConfig(option =>
|
||||||
|
{
|
||||||
|
option.ENV = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development";
|
||||||
|
});
|
||||||
|
builder.Host
|
||||||
|
.AddAppSettingsSecretsJson()
|
||||||
|
.UseAutofac()
|
||||||
|
.UseSerilog();
|
||||||
|
builder.Services.AddReverseProxy()
|
||||||
|
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
|
||||||
|
await builder.AddApplicationAsync<InternalGatewayModule>();
|
||||||
|
var app = builder.Build();
|
||||||
|
await app.InitializeApplicationAsync();
|
||||||
|
await app.RunAsync();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Log.CloseAndFlushAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
|
||||||
|
|
||||||
app.UseAuthorization();
|
|
||||||
|
|
||||||
app.MapControllers();
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
|
|||||||
@ -1,33 +1,24 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:15968",
|
|
||||||
"sslPort": 44395
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"http": {
|
"http": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "http://localhost:5090",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "http://localhost:5090"
|
||||||
},
|
},
|
||||||
"https": {
|
"https": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "https://localhost:7264;http://localhost:5090",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "https://localhost:7264;http://localhost:5090"
|
||||||
},
|
},
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
@ -36,6 +27,26 @@
|
|||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Container (Dockerfile)": {
|
||||||
|
"commandName": "Docker",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||||
|
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||||
|
},
|
||||||
|
"publishAllPorts": true,
|
||||||
|
"useSSL": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:15968",
|
||||||
|
"sslPort": 44395
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,13 +0,0 @@
|
|||||||
namespace KonSoft.InternalGateway
|
|
||||||
{
|
|
||||||
public class WeatherForecast
|
|
||||||
{
|
|
||||||
public DateOnly Date { get; set; }
|
|
||||||
|
|
||||||
public int TemperatureC { get; set; }
|
|
||||||
|
|
||||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
|
||||||
|
|
||||||
public string? Summary { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"AgileConfig": {
|
||||||
"LogLevel": {
|
"appId": "KonSoft.InternalGateway",
|
||||||
"Default": "Information",
|
"name": "KonSoft.InternalGateway",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"nodes": "https://config.konsoft.top/",
|
||||||
|
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace KonSoft.PublicGateway.Controllers
|
namespace KonSoft.PublicGateway.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class WeatherForecastController : ControllerBase
|
public class WeatherForecastController : ControllerBase
|
||||||
@ -30,4 +30,3 @@ namespace KonSoft.PublicGateway.Controllers
|
|||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
namespace KonSoft.PublicGateway
|
namespace KonSoft.PublicGateway;
|
||||||
{
|
|
||||||
public class WeatherForecast
|
public class WeatherForecast
|
||||||
{
|
{
|
||||||
public DateOnly Date { get; set; }
|
public DateOnly Date { get; set; }
|
||||||
@ -10,4 +10,3 @@ namespace KonSoft.PublicGateway
|
|||||||
|
|
||||||
public string? Summary { get; set; }
|
public string? Summary { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -23,9 +23,9 @@ public class AdminHttpApiHostModule : AbpModule
|
|||||||
var configuration = context.Services.GetConfiguration();
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
|
||||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||||
context: context,
|
context,
|
||||||
authority: configuration["AuthServer:Authority"]!,
|
configuration["AuthServer:Authority"]!,
|
||||||
scopes: ["AdministrationService"],
|
["AdministrationService"],
|
||||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||||
apiTitle: "Administration Service API"
|
apiTitle: "Administration Service API"
|
||||||
);
|
);
|
||||||
@ -74,4 +74,10 @@ public class AdminHttpApiHostModule : AbpModule
|
|||||||
app.UseAbpSerilogEnrichers();
|
app.UseAbpSerilogEnrichers();
|
||||||
app.UseConfiguredEndpoints();
|
app.UseConfiguredEndpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
|
||||||
|
//{
|
||||||
|
// await context.ServiceProvider.GetRequiredService<AdminPendingEfCoreMigrationsChecker>()
|
||||||
|
// .CheckAndApplyDatabaseMigrationsAsync();
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using Volo.Abp.Data;
|
||||||
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
|
namespace KonSoft.Admin.DbMigrations;
|
||||||
|
|
||||||
|
public class AdminDataSeedContributor : IDataSeedContributor, ITransientDependency
|
||||||
|
{
|
||||||
|
public Task SeedAsync(DataSeedContext context)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Data;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.DbMigrations
|
|
||||||
{
|
|
||||||
public class AdminDataSeeder : IDataSeedContributor, ITransientDependency
|
|
||||||
{
|
|
||||||
public Task SeedAsync(DataSeedContext context)
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,8 +6,8 @@ using Volo.Abp.EventBus.Distributed;
|
|||||||
using Volo.Abp.MultiTenancy;
|
using Volo.Abp.MultiTenancy;
|
||||||
using Volo.Abp.Uow;
|
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,
|
public AdminPendingEfCoreMigrationsChecker(IUnitOfWorkManager unitOfWorkManager,
|
||||||
@ -23,4 +23,3 @@ namespace KonSoft.Admin.DbMigrations
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@ WORKDIR /app
|
|||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|
||||||
# 此阶段用于生成服务项目
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|||||||
@ -17,6 +17,10 @@
|
|||||||
<None Remove="Logs\**" />
|
<None Remove="Logs\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" />
|
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" />
|
||||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" />
|
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" />
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using KonSoft.Admin;
|
using System;
|
||||||
|
using KonSoft.Admin;
|
||||||
using KonSoft.Shared.Hosting.AspNetCore;
|
using KonSoft.Shared.Hosting.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
|
||||||
|
|
||||||
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"http": {
|
"http": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
@ -8,6 +7,18 @@
|
|||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"applicationUrl": "https://localhost:44354"
|
"applicationUrl": "https://localhost:44354"
|
||||||
|
},
|
||||||
|
"Container (Dockerfile)": {
|
||||||
|
"commandName": "Docker",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||||
|
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||||
|
},
|
||||||
|
"publishAllPorts": true,
|
||||||
|
"useSSL": true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json"
|
||||||
}
|
}
|
||||||
@ -1,29 +1,13 @@
|
|||||||
{
|
{
|
||||||
"App": {
|
"AgileConfig": {
|
||||||
"CorsOrigins": "https://*.KonSoft.top"
|
"appId": "KonSoft.Admin.HttpApi.Host",
|
||||||
},
|
"name": "KonSoft.Admin.HttpApi.Host",
|
||||||
"ConnectionStrings": {
|
"nodes": "https://config.konsoft.top/",
|
||||||
"Default": "Host=1.94.99.47;Port=26666;Database=Clean;User ID=postgres;Password=zzx7845zzx;"
|
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||||
},
|
|
||||||
"Redis": {
|
|
||||||
"Configuration": "1.94.99.47:26668"
|
|
||||||
},
|
},
|
||||||
"AuthServer": {
|
"AuthServer": {
|
||||||
"Authority": "https://localhost:44397",
|
"Authority": "https://localhost:44322",
|
||||||
"RequireHttpsMetadata": true,
|
"RequireHttpsMetadata": true,
|
||||||
"SwaggerClientId": "Admin_Swagger"
|
"SwaggerClientId": "Admin_Swagger"
|
||||||
},
|
|
||||||
"StringEncryption": {
|
|
||||||
"DefaultPassPhrase": "g3NdNOyDR9oYj0gK"
|
|
||||||
},
|
|
||||||
"RabbitMQ": {
|
|
||||||
"Connections": {
|
|
||||||
"Default": {
|
|
||||||
"HostName": "1.94.99.47",
|
|
||||||
"Port": 26667,
|
|
||||||
"UserName": "admin",
|
|
||||||
"Password": "zzx7845zzx"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<location path="." inheritInChildApplications="false">
|
<location path="." inheritInChildApplications="false">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<handlers>
|
<handlers>
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Admin.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Admin.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||||
|
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</location>
|
</location>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|||||||
@ -2,7 +2,6 @@ using KonSoft.Dispatch.EntityFrameworkCore;
|
|||||||
using KonSoft.Shared.Hosting.AspNetCore;
|
using KonSoft.Shared.Hosting.AspNetCore;
|
||||||
using KonSoft.Shared.Hosting.Microservices;
|
using KonSoft.Shared.Hosting.Microservices;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
@ -24,9 +23,9 @@ public class DispatchHttpApiHostModule : AbpModule
|
|||||||
var configuration = context.Services.GetConfiguration();
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
|
||||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||||
context: context,
|
context,
|
||||||
authority: configuration["AuthServer:Authority"]!,
|
configuration["AuthServer:Authority"]!,
|
||||||
scopes: ["DispatchService"],
|
["DispatchService"],
|
||||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||||
apiTitle: "Dispatch Service API"
|
apiTitle: "Dispatch Service API"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace KonSoft.Dispatch;
|
|||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public async static Task<int> Main(string[] args)
|
public static async Task<int> Main(string[] args)
|
||||||
{
|
{
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<location path="." inheritInChildApplications="false">
|
<location path="." inheritInChildApplications="false">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<handlers>
|
<handlers>
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Dispatch.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Dispatch.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||||
|
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</location>
|
</location>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|||||||
@ -2,7 +2,6 @@ using KonSoft.Payment.EntityFrameworkCore;
|
|||||||
using KonSoft.Shared.Hosting.AspNetCore;
|
using KonSoft.Shared.Hosting.AspNetCore;
|
||||||
using KonSoft.Shared.Hosting.Microservices;
|
using KonSoft.Shared.Hosting.Microservices;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
@ -24,9 +23,9 @@ public class PaymentHttpApiHostModule : AbpModule
|
|||||||
var configuration = context.Services.GetConfiguration();
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
|
||||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||||
context: context,
|
context,
|
||||||
authority: configuration["AuthServer:Authority"]!,
|
configuration["AuthServer:Authority"]!,
|
||||||
scopes: ["PaymentService"],
|
["PaymentService"],
|
||||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||||
apiTitle: "Payment Service API"
|
apiTitle: "Payment Service API"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace KonSoft.Payment;
|
|||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public async static Task<int> Main(string[] args)
|
public static async Task<int> Main(string[] args)
|
||||||
{
|
{
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<location path="." inheritInChildApplications="false">
|
<location path="." inheritInChildApplications="false">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<handlers>
|
<handlers>
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Payment.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Payment.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||||
|
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</location>
|
</location>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace KonSoft.Report;
|
|||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public async static Task<int> Main(string[] args)
|
public static async Task<int> Main(string[] args)
|
||||||
{
|
{
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@ -2,7 +2,6 @@ using KonSoft.Report.EntityFrameworkCore;
|
|||||||
using KonSoft.Shared.Hosting.AspNetCore;
|
using KonSoft.Shared.Hosting.AspNetCore;
|
||||||
using KonSoft.Shared.Hosting.Microservices;
|
using KonSoft.Shared.Hosting.Microservices;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
@ -24,9 +23,9 @@ public class ReportHttpApiHostModule : AbpModule
|
|||||||
var configuration = context.Services.GetConfiguration();
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
|
||||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||||
context: context,
|
context,
|
||||||
authority: configuration["AuthServer:Authority"]!,
|
configuration["AuthServer:Authority"]!,
|
||||||
scopes: ["ReportService"],
|
["ReportService"],
|
||||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||||
apiTitle: "Report Service API"
|
apiTitle: "Report Service API"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<location path="." inheritInChildApplications="false">
|
<location path="." inheritInChildApplications="false">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<handlers>
|
<handlers>
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Report.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
<aspNetCore processPath="dotnet" arguments=".\KonSoft.Report.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||||
|
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</location>
|
</location>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace KonSoft.TenantManagement;
|
|||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public async static Task<int> Main(string[] args)
|
public static async Task<int> Main(string[] args)
|
||||||
{
|
{
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@ -2,7 +2,6 @@ using KonSoft.Shared.Hosting.AspNetCore;
|
|||||||
using KonSoft.Shared.Hosting.Microservices;
|
using KonSoft.Shared.Hosting.Microservices;
|
||||||
using KonSoft.TenantManagement.EntityFrameworkCore;
|
using KonSoft.TenantManagement.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
@ -24,9 +23,9 @@ public class TenantManagementHttpApiHostModule : AbpModule
|
|||||||
var configuration = context.Services.GetConfiguration();
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
|
||||||
SwaggerConfigurationHelper.ConfigureWithOidc(
|
SwaggerConfigurationHelper.ConfigureWithOidc(
|
||||||
context: context,
|
context,
|
||||||
authority: configuration["AuthServer:Authority"]!,
|
configuration["AuthServer:Authority"]!,
|
||||||
scopes: ["TenantManagementService"],
|
["TenantManagementService"],
|
||||||
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
discoveryEndpoint: configuration["AuthServer:MetadataAddress"],
|
||||||
apiTitle: "TenantManagement Service API"
|
apiTitle: "TenantManagement Service API"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<location path="." inheritInChildApplications="false">
|
<location path="." inheritInChildApplications="false">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
<handlers>
|
<handlers>
|
||||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<aspNetCore processPath="dotnet" arguments=".\KonSoft.TenantManagement.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
<aspNetCore processPath="dotnet" arguments=".\KonSoft.TenantManagement.HttpApi.Host.dll" stdoutLogEnabled="false"
|
||||||
|
stdoutLogFile=".\Logs\stdout" hostingModel="inprocess" />
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
</location>
|
</location>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
using Volo.Abp.Identity;
|
using Volo.Abp.Threading;
|
||||||
using Volo.Abp.ObjectExtending;
|
|
||||||
using Volo.Abp.Threading;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin;
|
namespace KonSoft.Admin;
|
||||||
|
|
||||||
public static class AdminDtoExtensions
|
public static class AdminDtoExtensions
|
||||||
{
|
{
|
||||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||||
|
|
||||||
public static void Configure()
|
public static void Configure()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
using System;
|
namespace KonSoft.Admin.Dtos;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.Dtos
|
|
||||||
{
|
|
||||||
public class AddressDto
|
public class AddressDto
|
||||||
{
|
{
|
||||||
public string ContactName { get; set; }
|
public string ContactName { get; set; }
|
||||||
@ -14,4 +8,3 @@ namespace KonSoft.Admin.Dtos
|
|||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
public string District { get; set; }
|
public string District { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,25 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
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]
|
[Required] public Guid CustomerId { get; set; }
|
||||||
public Guid CustomerId { get; set; }
|
|
||||||
[Required]
|
[Required] public Guid ServiceCategoryId { get; set; }
|
||||||
public Guid ServiceCategoryId { get; set; }
|
|
||||||
[Required]
|
[Required] public DateTime ServiceTime { get; set; }
|
||||||
public DateTime ServiceTime { get; set; }
|
|
||||||
[Required]
|
[Required] public decimal Amount { get; set; }
|
||||||
public decimal Amount { get; set; }
|
|
||||||
[Required]
|
[Required] public AddressDto Address { get; set; }
|
||||||
public AddressDto Address { get; set; }
|
|
||||||
|
|
||||||
public string Remark { get; set; }
|
public string Remark { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,14 +1,9 @@
|
|||||||
using System;
|
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 string Name { get; set; }
|
||||||
public Guid? ParentId { get; set; }
|
public Guid? ParentId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
using KonSoft.Admin.Enums;
|
using System;
|
||||||
using System;
|
using KonSoft.Admin.Enums;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
namespace KonSoft.Admin.Dtos;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Application.Dtos;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.Dtos
|
|
||||||
{
|
|
||||||
public class OrderDto
|
public class OrderDto
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
@ -23,4 +18,3 @@ namespace KonSoft.Admin.Dtos
|
|||||||
public AddressDto Address { get; set; }
|
public AddressDto Address { get; set; }
|
||||||
public string Remark { get; set; }
|
public string Remark { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,12 +1,5 @@
|
|||||||
using System;
|
namespace KonSoft.Admin.Dtos;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.Dtos
|
|
||||||
{
|
|
||||||
public class PayOrderDto
|
public class PayOrderDto
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,14 +1,8 @@
|
|||||||
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
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>
|
||||||
@ -28,6 +22,7 @@ namespace KonSoft.Admin.Dtos
|
|||||||
/// 商品编码
|
/// 商品编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Code { get; private set; }
|
public string Code { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 商品价格
|
/// 商品价格
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -63,4 +58,3 @@ namespace KonSoft.Admin.Dtos
|
|||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,17 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
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 Guid Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public Guid? ParentId { get; set; }
|
public Guid? ParentId { get; set; }
|
||||||
public int Level { get; set; }
|
public int Level { get; set; }
|
||||||
public List<ServiceCategoryDto> Children { get; set; } = new List<ServiceCategoryDto>();
|
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.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Application.Dtos;
|
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 Name { get; set; }
|
||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
public List<Guid> SkillCategoryIds { get; set; } = new(); // 擅长服务类型
|
public List<Guid> SkillCategoryIds { get; set; } = new(); // 擅长服务类型
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
using KonSoft.Admin.Dtos;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using KonSoft.Admin.Dtos;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
using Volo.Abp.Application.Services;
|
using Volo.Abp.Application.Services;
|
||||||
|
|
||||||
namespace KonSoft.Admin.IApplicationServices
|
namespace KonSoft.Admin.IApplicationServices;
|
||||||
{
|
|
||||||
public interface IOrderAppService : IApplicationService
|
public interface IOrderAppService : IApplicationService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -14,6 +14,7 @@ namespace KonSoft.Admin.IApplicationServices
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<OrderDto> CreateAsync(CreateOrderDto input);
|
Task<OrderDto> CreateAsync(CreateOrderDto input);
|
||||||
|
|
||||||
Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input);
|
Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input);
|
||||||
Task AssignAsync(Guid orderId, Guid workerId);
|
Task AssignAsync(Guid orderId, Guid workerId);
|
||||||
Task StartServiceAsync(Guid orderId);
|
Task StartServiceAsync(Guid orderId);
|
||||||
@ -25,4 +26,3 @@ namespace KonSoft.Admin.IApplicationServices
|
|||||||
Task<OrderDto> GetAsync(Guid id);
|
Task<OrderDto> GetAsync(Guid id);
|
||||||
Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input);
|
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.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
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<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input);
|
||||||
Task DeleteAsync(Guid id);
|
Task DeleteAsync(Guid id);
|
||||||
Task<List<ServiceCategoryDto>> GetTreeAsync();
|
Task<List<ServiceCategoryDto>> GetTreeAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,13 +1,7 @@
|
|||||||
using System;
|
using Volo.Abp.Application.Services;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
namespace KonSoft.Admin.IApplicationServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Application.Services;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.IApplicationServices
|
|
||||||
{
|
|
||||||
public interface IWorkerAppService : IApplicationService
|
public interface IWorkerAppService : IApplicationService
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,15 +1,5 @@
|
|||||||
using System;
|
namespace KonSoft.Admin.IApplicationServices;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.IApplicationServices
|
|
||||||
{
|
|
||||||
public interface IWorkerAssignmentService
|
public interface IWorkerAssignmentService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,7 +1,4 @@
|
|||||||
using System;
|
using KonSoft.Admin.Localization;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using KonSoft.Admin.Localization;
|
|
||||||
using Volo.Abp.Application.Services;
|
using Volo.Abp.Application.Services;
|
||||||
|
|
||||||
namespace KonSoft.Admin;
|
namespace KonSoft.Admin;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using KonSoft.Admin.Dtos;
|
using KonSoft.Admin.Dtos;
|
||||||
using KonSoft.Admin.Entities;
|
using KonSoft.Admin.Entities;
|
||||||
|
using KonSoft.Admin.ValueObjects;
|
||||||
|
|
||||||
namespace KonSoft.Admin;
|
namespace KonSoft.Admin;
|
||||||
|
|
||||||
|
|||||||
@ -23,9 +23,6 @@ public class AdminApplicationModule : AbpModule
|
|||||||
{
|
{
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
Configure<AbpAutoMapperOptions>(options =>
|
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<AdminApplicationModule>(); });
|
||||||
{
|
|
||||||
options.AddMaps<AdminApplicationModule>();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,18 +1,19 @@
|
|||||||
using KonSoft.Admin.Dtos;
|
using System;
|
||||||
using KonSoft.Admin.Entities;
|
|
||||||
using KonSoft.Admin.IApplicationServices;
|
|
||||||
using KonSoft.Admin.Repositories;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using KonSoft.Admin.Dtos;
|
||||||
|
using KonSoft.Admin.Entities;
|
||||||
|
using KonSoft.Admin.IApplicationServices;
|
||||||
|
using KonSoft.Admin.IRepositories;
|
||||||
|
using KonSoft.Admin.ValueObjects;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
using Volo.Abp.Application.Services;
|
using Volo.Abp.Application.Services;
|
||||||
using Volo.Abp.Domain.Repositories;
|
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;
|
private readonly IOrderRepository _orderRepository = orderRepository;
|
||||||
@ -78,7 +79,8 @@ namespace KonSoft.Admin.ApplicationServices
|
|||||||
// 生成订单号 TODO
|
// 生成订单号 TODO
|
||||||
var orderSN = "SN001";
|
var orderSN = "SN001";
|
||||||
var address = ObjectMapper.Map<AddressDto, AddressInfo>(input.Address);
|
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);
|
var order = new Order(input.CustomerId, input.ServiceCategoryId, input.ServiceTime,
|
||||||
|
input.Amount, address, input.Remark);
|
||||||
|
|
||||||
await _orderRepository.InsertAsync(order);
|
await _orderRepository.InsertAsync(order);
|
||||||
return ObjectMapper.Map<Order, OrderDto>(order);
|
return ObjectMapper.Map<Order, OrderDto>(order);
|
||||||
@ -97,7 +99,8 @@ namespace KonSoft.Admin.ApplicationServices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改订单信息
|
/// 修改订单信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input">订单DTO对象</param>s
|
/// <param name="input">订单DTO对象</param>
|
||||||
|
/// s
|
||||||
public async Task EditAsync(OrderDto input)
|
public async Task EditAsync(OrderDto input)
|
||||||
{
|
{
|
||||||
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
// 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】
|
||||||
@ -162,4 +165,3 @@ namespace KonSoft.Admin.ApplicationServices
|
|||||||
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,16 +1,15 @@
|
|||||||
using KonSoft.Admin.Dtos;
|
using System;
|
||||||
using KonSoft.Admin.Entities;
|
|
||||||
using KonSoft.Admin.IApplicationServices;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using KonSoft.Admin.Dtos;
|
||||||
|
using KonSoft.Admin.Entities;
|
||||||
|
using KonSoft.Admin.IApplicationServices;
|
||||||
using Volo.Abp.Application.Services;
|
using Volo.Abp.Application.Services;
|
||||||
using Volo.Abp.Domain.Repositories;
|
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;
|
private readonly IRepository<ServiceCategory, Guid> _repository;
|
||||||
@ -42,7 +41,10 @@ namespace KonSoft.Admin.ApplicationServices
|
|||||||
public async Task DeleteAsync(Guid id)
|
public async Task DeleteAsync(Guid id)
|
||||||
{
|
{
|
||||||
var hasChildren = await _repository.AnyAsync(c => c.ParentId == id);
|
var hasChildren = await _repository.AnyAsync(c => c.ParentId == id);
|
||||||
if (hasChildren) throw new InvalidOperationException("存在子节点无法删除!");
|
if (hasChildren)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("存在子节点无法删除!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
await _repository.DeleteAsync(o => o.Id == id);
|
await _repository.DeleteAsync(o => o.Id == id);
|
||||||
@ -53,7 +55,8 @@ namespace KonSoft.Admin.ApplicationServices
|
|||||||
var allCategories = await _repository.GetListAsync();
|
var allCategories = await _repository.GetListAsync();
|
||||||
|
|
||||||
// 构建树
|
// 构建树
|
||||||
var lookup = allCategories.ToDictionary(c => c.Id, c => ObjectMapper.Map<ServiceCategory, ServiceCategoryDto>(c));
|
var lookup =
|
||||||
|
allCategories.ToDictionary(c => c.Id, c => ObjectMapper.Map<ServiceCategory, ServiceCategoryDto>(c));
|
||||||
var rootList = new List<ServiceCategoryDto>();
|
var rootList = new List<ServiceCategoryDto>();
|
||||||
|
|
||||||
|
|
||||||
@ -72,4 +75,3 @@ namespace KonSoft.Admin.ApplicationServices
|
|||||||
return rootList.OrderBy(c => c.Name).ToList();
|
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;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Application.Tests")]
|
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Application.Tests")]
|
||||||
@ -35,10 +35,7 @@ public class AdminDomainSharedModule : AbpModule
|
|||||||
|
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
Configure<AbpVirtualFileSystemOptions>(options =>
|
Configure<AbpVirtualFileSystemOptions>(options => { options.FileSets.AddEmbedded<AdminDomainSharedModule>(); });
|
||||||
{
|
|
||||||
options.FileSets.AddEmbedded<AdminDomainSharedModule>();
|
|
||||||
});
|
|
||||||
|
|
||||||
Configure<AbpLocalizationOptions>(options =>
|
Configure<AbpLocalizationOptions>(options =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ namespace KonSoft.Admin;
|
|||||||
|
|
||||||
public static class AdminGlobalFeatureConfigurator
|
public static class AdminGlobalFeatureConfigurator
|
||||||
{
|
{
|
||||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||||
|
|
||||||
public static void Configure()
|
public static void Configure()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using Volo.Abp.Threading;
|
||||||
using Volo.Abp.Identity;
|
|
||||||
using Volo.Abp.ObjectExtending;
|
|
||||||
using Volo.Abp.Threading;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin;
|
namespace KonSoft.Admin;
|
||||||
|
|
||||||
public static class AdminModuleExtensionConfigurator
|
public static class AdminModuleExtensionConfigurator
|
||||||
{
|
{
|
||||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||||
|
|
||||||
public static void Configure()
|
public static void Configure()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
using System;
|
namespace KonSoft.Admin.Enums;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.Enums
|
|
||||||
{
|
|
||||||
public enum OrderStatus
|
public enum OrderStatus
|
||||||
{
|
{
|
||||||
PendingPayment, // 待支付
|
PendingPayment, // 待支付
|
||||||
@ -17,6 +11,4 @@ namespace KonSoft.Admin.Enums
|
|||||||
Canceled, // 已取消
|
Canceled, // 已取消
|
||||||
Refunding, // 退款中
|
Refunding, // 退款中
|
||||||
Refunded // 已退款
|
Refunded // 已退款
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -5,5 +5,4 @@ namespace KonSoft.Admin.Localization;
|
|||||||
[LocalizationResourceName("Admin")]
|
[LocalizationResourceName("Admin")]
|
||||||
public class AdminResource
|
public class AdminResource
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3,6 +3,6 @@
|
|||||||
public static class AdminConsts
|
public static class AdminConsts
|
||||||
{
|
{
|
||||||
public const string DbTablePrefix = "App";
|
public const string DbTablePrefix = "App";
|
||||||
|
public const string DbSchema = "";
|
||||||
public const string DbSchema = null;
|
public const string ConnectionStringName = "Default";
|
||||||
}
|
}
|
||||||
@ -7,7 +7,6 @@ using Volo.Abp.FeatureManagement;
|
|||||||
using Volo.Abp.Identity;
|
using Volo.Abp.Identity;
|
||||||
using Volo.Abp.Localization;
|
using Volo.Abp.Localization;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
using Volo.Abp.MultiTenancy;
|
|
||||||
using Volo.Abp.OpenIddict;
|
using Volo.Abp.OpenIddict;
|
||||||
using Volo.Abp.PermissionManagement.Identity;
|
using Volo.Abp.PermissionManagement.Identity;
|
||||||
using Volo.Abp.PermissionManagement.OpenIddict;
|
using Volo.Abp.PermissionManagement.OpenIddict;
|
||||||
|
|||||||
@ -17,12 +17,11 @@ namespace KonSoft.Admin.Data;
|
|||||||
|
|
||||||
public class AdminDbMigrationService : ITransientDependency
|
public class AdminDbMigrationService : ITransientDependency
|
||||||
{
|
{
|
||||||
public ILogger<AdminDbMigrationService> Logger { get; set; }
|
private readonly ICurrentTenant _currentTenant;
|
||||||
|
|
||||||
private readonly IDataSeeder _dataSeeder;
|
private readonly IDataSeeder _dataSeeder;
|
||||||
private readonly IEnumerable<IAdminDbSchemaMigrator> _dbSchemaMigrators;
|
private readonly IEnumerable<IAdminDbSchemaMigrator> _dbSchemaMigrators;
|
||||||
private readonly ITenantRepository _tenantRepository;
|
private readonly ITenantRepository _tenantRepository;
|
||||||
private readonly ICurrentTenant _currentTenant;
|
|
||||||
|
|
||||||
public AdminDbMigrationService(
|
public AdminDbMigrationService(
|
||||||
IDataSeeder dataSeeder,
|
IDataSeeder dataSeeder,
|
||||||
@ -38,6 +37,8 @@ public class AdminDbMigrationService : ITransientDependency
|
|||||||
Logger = NullLogger<AdminDbMigrationService>.Instance;
|
Logger = NullLogger<AdminDbMigrationService>.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ILogger<AdminDbMigrationService> Logger { get; set; }
|
||||||
|
|
||||||
public async Task MigrateAsync()
|
public async Task MigrateAsync()
|
||||||
{
|
{
|
||||||
var initialMigrationAdded = AddInitialMigrationIfNotExist();
|
var initialMigrationAdded = AddInitialMigrationIfNotExist();
|
||||||
@ -52,7 +53,7 @@ public class AdminDbMigrationService : ITransientDependency
|
|||||||
await MigrateDatabaseSchemaAsync();
|
await MigrateDatabaseSchemaAsync();
|
||||||
await SeedDataAsync();
|
await SeedDataAsync();
|
||||||
|
|
||||||
Logger.LogInformation($"Successfully completed host database migrations.");
|
Logger.LogInformation("Successfully completed host database migrations.");
|
||||||
|
|
||||||
var tenants = await _tenantRepository.GetListAsync(includeDetails: true);
|
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...");
|
Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed...");
|
||||||
|
|
||||||
await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id)
|
await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id)
|
||||||
.WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue)
|
.WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName,
|
||||||
.WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue)
|
IdentityDataSeedContributor.AdminEmailDefaultValue)
|
||||||
|
.WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName,
|
||||||
|
IdentityDataSeedContributor.AdminPasswordDefaultValue)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,11 +130,9 @@ public class AdminDbMigrationService : ITransientDependency
|
|||||||
AddInitialMigration();
|
AddInitialMigration();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.LogWarning("Couldn't determinate if any migrations exist : " + e.Message);
|
Logger.LogWarning("Couldn't determinate if any migrations exist : " + e.Message);
|
||||||
@ -149,7 +150,8 @@ public class AdminDbMigrationService : ITransientDependency
|
|||||||
private bool MigrationsFolderExists()
|
private bool MigrationsFolderExists()
|
||||||
{
|
{
|
||||||
var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath();
|
var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath();
|
||||||
return dbMigrationsProjectFolder != null && Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations"));
|
return dbMigrationsProjectFolder != null &&
|
||||||
|
Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddInitialMigration()
|
private void AddInitialMigration()
|
||||||
@ -207,7 +209,8 @@ public class AdminDbMigrationService : ITransientDependency
|
|||||||
{
|
{
|
||||||
currentDirectory = Directory.GetParent(currentDirectory.FullName);
|
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;
|
return currentDirectory.FullName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Domain.Entities;
|
|
||||||
using Volo.Abp.Domain.Values;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.Entities
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 地址
|
|
||||||
/// </summary>
|
|
||||||
public class AddressInfo : ValueObject
|
|
||||||
{
|
|
||||||
/// <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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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,85 +1,20 @@
|
|||||||
using KonSoft.Admin.Enums;
|
using System;
|
||||||
using System;
|
using KonSoft.Admin.Enums;
|
||||||
using System.Collections.Generic;
|
using KonSoft.Admin.ValueObjects;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Domain.Entities.Auditing;
|
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>
|
||||||
{
|
{
|
||||||
/// <summary>
|
private Order()
|
||||||
/// 订单编号
|
{
|
||||||
/// </summary>
|
}
|
||||||
public string OrderSN { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
public Order(Guid customerId, Guid serviceCategoryId, DateTime serviceTime, decimal amount,
|
||||||
/// 用户ID
|
AddressInfo address, string? remark = null)
|
||||||
/// </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;
|
CustomerId = customerId;
|
||||||
ServiceCategoryId = serviceCategoryId;
|
ServiceCategoryId = serviceCategoryId;
|
||||||
ServiceTime = serviceTime;
|
ServiceTime = serviceTime;
|
||||||
@ -89,11 +24,68 @@ namespace KonSoft.Admin.Entities
|
|||||||
Status = OrderStatus.PendingPayment;
|
Status = OrderStatus.PendingPayment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户ID
|
||||||
|
/// </summary>
|
||||||
|
public Guid CustomerId { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 家政人员ID
|
||||||
|
/// </summary>
|
||||||
|
public Guid? WorkerId { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 服务项目ID
|
||||||
|
/// </summary>
|
||||||
|
public Guid ServiceCategoryId { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 服务预约时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime ServiceTime { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单状态
|
||||||
|
/// </summary>
|
||||||
|
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)
|
public void MarkPaid(decimal paidAmount, string method)
|
||||||
{
|
{
|
||||||
if (Status != OrderStatus.PendingPayment)
|
if (Status != OrderStatus.PendingPayment)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("订单不在待付款状态");
|
throw new InvalidOperationException("订单不在待付款状态");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PaidAmount = paidAmount;
|
PaidAmount = paidAmount;
|
||||||
@ -105,7 +97,9 @@ namespace KonSoft.Admin.Entities
|
|||||||
public void AssignWorker(Guid workerId)
|
public void AssignWorker(Guid workerId)
|
||||||
{
|
{
|
||||||
if (Status != OrderStatus.PaidWaitingAssign)
|
if (Status != OrderStatus.PaidWaitingAssign)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("订单无法分配师傅");
|
throw new InvalidOperationException("订单无法分配师傅");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WorkerId = workerId;
|
WorkerId = workerId;
|
||||||
@ -116,7 +110,9 @@ namespace KonSoft.Admin.Entities
|
|||||||
public void StartService()
|
public void StartService()
|
||||||
{
|
{
|
||||||
if (Status != OrderStatus.AssignedWaitingService)
|
if (Status != OrderStatus.AssignedWaitingService)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("订单无法开始");
|
throw new InvalidOperationException("订单无法开始");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = OrderStatus.InService;
|
Status = OrderStatus.InService;
|
||||||
@ -126,7 +122,9 @@ namespace KonSoft.Admin.Entities
|
|||||||
public void CompleteService()
|
public void CompleteService()
|
||||||
{
|
{
|
||||||
if (Status != OrderStatus.InService)
|
if (Status != OrderStatus.InService)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("订单未开始服务,无法完成");
|
throw new InvalidOperationException("订单未开始服务,无法完成");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = OrderStatus.WaitingConfirm;
|
Status = OrderStatus.WaitingConfirm;
|
||||||
@ -136,7 +134,9 @@ namespace KonSoft.Admin.Entities
|
|||||||
public void ConfirmCompletion()
|
public void ConfirmCompletion()
|
||||||
{
|
{
|
||||||
if (Status != OrderStatus.WaitingConfirm)
|
if (Status != OrderStatus.WaitingConfirm)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("订单无法确认");
|
throw new InvalidOperationException("订单无法确认");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = OrderStatus.Completed;
|
Status = OrderStatus.Completed;
|
||||||
@ -147,11 +147,12 @@ namespace KonSoft.Admin.Entities
|
|||||||
{
|
{
|
||||||
// 若已完成或退款中则不可取消
|
// 若已完成或退款中则不可取消
|
||||||
if (Status == OrderStatus.Completed || Status == OrderStatus.Refunding || Status == OrderStatus.Refunded)
|
if (Status == OrderStatus.Completed || Status == OrderStatus.Refunding || Status == OrderStatus.Refunded)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("订单无法被取消");
|
throw new InvalidOperationException("订单无法被取消");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CancelReason = reason;
|
CancelReason = reason;
|
||||||
Status = OrderStatus.Canceled;
|
Status = OrderStatus.Canceled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,12 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
|
||||||
using Volo.Abp.Domain.Entities.Auditing;
|
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>
|
||||||
/// 分类名称
|
/// 分类名称
|
||||||
@ -48,8 +56,7 @@ namespace KonSoft.Admin.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Order { get; private set; } = order;
|
public int Order { get; private set; } = order;
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped] public List<Product> Children { get; set; } = new();
|
||||||
public List<Product> Children { get; set; } = new();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改商品信息
|
/// 修改商品信息
|
||||||
@ -96,4 +103,3 @@ namespace KonSoft.Admin.Entities
|
|||||||
Price = newPrice;
|
Price = newPrice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,20 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Domain.Entities.Auditing;
|
using Volo.Abp.Domain.Entities.Auditing;
|
||||||
|
|
||||||
namespace KonSoft.Admin.Entities
|
namespace KonSoft.Admin.Entities;
|
||||||
{
|
|
||||||
public class ServiceCategory : FullAuditedAggregateRoot<Guid>
|
public class ServiceCategory : FullAuditedAggregateRoot<Guid>
|
||||||
{
|
{
|
||||||
public string Name { get; private set; }
|
protected ServiceCategory()
|
||||||
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)
|
public ServiceCategory(Guid id, string name)
|
||||||
: base(id)
|
: base(id)
|
||||||
@ -30,8 +23,16 @@ namespace KonSoft.Admin.Entities
|
|||||||
Level = level;
|
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 UpdateName(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetParent(ServiceCategory parent)
|
public void SetParent(ServiceCategory parent)
|
||||||
@ -40,7 +41,4 @@ namespace KonSoft.Admin.Entities
|
|||||||
Level = (parent?.Level ?? 0) + 1;
|
Level = (parent?.Level ?? 0) + 1;
|
||||||
Path = parent != null ? $"{parent.Path}/{Id}" : Id.ToString();
|
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 KonSoft.Admin.Entities;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp.Domain.Repositories;
|
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.Collections.Generic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using KonSoft.Admin.Entities;
|
||||||
using Volo.Abp.Domain.Repositories;
|
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
|
public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDependency
|
||||||
{
|
{
|
||||||
|
private readonly IAbpApplicationManager _applicationManager;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository;
|
private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository;
|
||||||
private readonly IAbpApplicationManager _applicationManager;
|
|
||||||
private readonly IOpenIddictScopeRepository _openIddictScopeRepository;
|
private readonly IOpenIddictScopeRepository _openIddictScopeRepository;
|
||||||
private readonly IOpenIddictScopeManager _scopeManager;
|
|
||||||
private readonly IPermissionDataSeeder _permissionDataSeeder;
|
private readonly IPermissionDataSeeder _permissionDataSeeder;
|
||||||
|
private readonly IOpenIddictScopeManager _scopeManager;
|
||||||
private readonly IStringLocalizer<OpenIddictResponse> L;
|
private readonly IStringLocalizer<OpenIddictResponse> L;
|
||||||
|
|
||||||
public OpenIddictDataSeedContributor(
|
public OpenIddictDataSeedContributor(
|
||||||
@ -60,7 +60,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
{
|
{
|
||||||
if (await _openIddictScopeRepository.FindByNameAsync("Admin") == null)
|
if (await _openIddictScopeRepository.FindByNameAsync("Admin") == null)
|
||||||
{
|
{
|
||||||
await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor {
|
await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor
|
||||||
|
{
|
||||||
Name = "Admin", DisplayName = "Admin API", Resources = { "Admin" }
|
Name = "Admin", DisplayName = "Admin API", Resources = { "Admin" }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -68,7 +69,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
|
|
||||||
private async Task CreateApplicationsAsync()
|
private async Task CreateApplicationsAsync()
|
||||||
{
|
{
|
||||||
var commonScopes = new List<string> {
|
var commonScopes = new List<string>
|
||||||
|
{
|
||||||
OpenIddictConstants.Permissions.Scopes.Address,
|
OpenIddictConstants.Permissions.Scopes.Address,
|
||||||
OpenIddictConstants.Permissions.Scopes.Email,
|
OpenIddictConstants.Permissions.Scopes.Email,
|
||||||
OpenIddictConstants.Permissions.Scopes.Phone,
|
OpenIddictConstants.Permissions.Scopes.Phone,
|
||||||
@ -80,10 +82,6 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
var configurationSection = _configuration.GetSection("OpenIddict:Applications");
|
var configurationSection = _configuration.GetSection("OpenIddict:Applications");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Swagger Client
|
// Swagger Client
|
||||||
var swaggerClientId = configurationSection["Admin_Swagger:ClientId"];
|
var swaggerClientId = configurationSection["Admin_Swagger:ClientId"];
|
||||||
if (!swaggerClientId.IsNullOrWhiteSpace())
|
if (!swaggerClientId.IsNullOrWhiteSpace())
|
||||||
@ -91,13 +89,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
var swaggerRootUrl = configurationSection["Admin_Swagger:RootUrl"]?.TrimEnd('/');
|
var swaggerRootUrl = configurationSection["Admin_Swagger:RootUrl"]?.TrimEnd('/');
|
||||||
|
|
||||||
await CreateApplicationAsync(
|
await CreateApplicationAsync(
|
||||||
name: swaggerClientId!,
|
swaggerClientId!,
|
||||||
type: OpenIddictConstants.ClientTypes.Public,
|
OpenIddictConstants.ClientTypes.Public,
|
||||||
consentType: OpenIddictConstants.ConsentTypes.Implicit,
|
OpenIddictConstants.ConsentTypes.Implicit,
|
||||||
displayName: "Swagger Application",
|
"Swagger Application",
|
||||||
secret: null,
|
null,
|
||||||
grantTypes: [OpenIddictConstants.GrantTypes.AuthorizationCode],
|
[OpenIddictConstants.GrantTypes.AuthorizationCode],
|
||||||
scopes: commonScopes,
|
commonScopes,
|
||||||
redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html",
|
redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html",
|
||||||
clientUri: swaggerRootUrl
|
clientUri: swaggerRootUrl
|
||||||
);
|
);
|
||||||
@ -131,13 +129,14 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
|
|
||||||
var client = await _openIddictApplicationRepository.FindByClientIdAsync(name);
|
var client = await _openIddictApplicationRepository.FindByClientIdAsync(name);
|
||||||
|
|
||||||
var application = new AbpApplicationDescriptor {
|
var application = new AbpApplicationDescriptor
|
||||||
|
{
|
||||||
ClientId = name,
|
ClientId = name,
|
||||||
ClientType = type,
|
ClientType = type,
|
||||||
ClientSecret = secret,
|
ClientSecret = secret,
|
||||||
ConsentType = consentType,
|
ConsentType = consentType,
|
||||||
DisplayName = displayName,
|
DisplayName = displayName,
|
||||||
ClientUri = clientUri,
|
ClientUri = clientUri
|
||||||
};
|
};
|
||||||
|
|
||||||
Check.NotNullOrEmpty(grantTypes, nameof(grantTypes));
|
Check.NotNullOrEmpty(grantTypes, nameof(grantTypes));
|
||||||
@ -160,7 +159,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout);
|
application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout);
|
||||||
}
|
}
|
||||||
|
|
||||||
var buildInGrantTypes = new[] {
|
var buildInGrantTypes = new[]
|
||||||
|
{
|
||||||
OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password,
|
OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password,
|
||||||
OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials,
|
OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials,
|
||||||
OpenIddictConstants.GrantTypes.DeviceCode, OpenIddictConstants.GrantTypes.RefreshToken
|
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.Address, OpenIddictConstants.Permissions.Scopes.Email,
|
||||||
OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile,
|
OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile,
|
||||||
OpenIddictConstants.Permissions.Scopes.Roles
|
OpenIddictConstants.Permissions.Scopes.Roles
|
||||||
@ -289,8 +290,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
await _permissionDataSeeder.SeedAsync(
|
await _permissionDataSeeder.SeedAsync(
|
||||||
ClientPermissionValueProvider.ProviderName,
|
ClientPermissionValueProvider.ProviderName,
|
||||||
name,
|
name,
|
||||||
permissions,
|
permissions
|
||||||
null
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,8 +302,10 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
|
|
||||||
if (!HasSameRedirectUris(client, application))
|
if (!HasSameRedirectUris(client, application))
|
||||||
{
|
{
|
||||||
client.RedirectUris = JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
client.RedirectUris =
|
||||||
client.PostLogoutRedirectUris = JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/')));
|
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());
|
await _applicationManager.UpdateAsync(client.ToModel());
|
||||||
}
|
}
|
||||||
@ -317,11 +319,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep
|
|||||||
|
|
||||||
private bool HasSameRedirectUris(OpenIddictApplication existingClient, AbpApplicationDescriptor application)
|
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)
|
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;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Domain.Tests")]
|
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Domain.Tests")]
|
||||||
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.TestBase")]
|
[assembly: InternalsVisibleToAttribute("KonSoft.Admin.TestBase")]
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Volo.Abp.Domain.Values;
|
||||||
|
|
||||||
|
namespace KonSoft.Admin.ValueObjects;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
public class AddressInfo : ValueObject
|
||||||
|
{
|
||||||
|
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; 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; }
|
||||||
|
|
||||||
|
|
||||||
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
|
{
|
||||||
|
yield return ContactName;
|
||||||
|
yield return ContactPhone;
|
||||||
|
yield return DetailAddress;
|
||||||
|
yield return City;
|
||||||
|
yield return District;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using KonSoft.Admin.Entities;
|
using KonSoft.Admin.EntityFrameworkCore.Configures;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
||||||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
|
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
|
||||||
@ -18,60 +18,21 @@ namespace KonSoft.Admin.EntityFrameworkCore;
|
|||||||
|
|
||||||
[ReplaceDbContext(typeof(IIdentityDbContext))]
|
[ReplaceDbContext(typeof(IIdentityDbContext))]
|
||||||
[ReplaceDbContext(typeof(ITenantManagementDbContext))]
|
[ReplaceDbContext(typeof(ITenantManagementDbContext))]
|
||||||
[ConnectionStringName("Default")]
|
[ConnectionStringName(AdminConsts.ConnectionStringName)]
|
||||||
public class AdminDbContext :
|
public class AdminDbContext :
|
||||||
AbpDbContext<AdminDbContext>,
|
AbpDbContext<AdminDbContext>,
|
||||||
IIdentityDbContext,
|
IIdentityDbContext,
|
||||||
ITenantManagementDbContext
|
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)
|
public AdminDbContext(DbContextOptions<AdminDbContext> options)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder builder)
|
protected override void OnModelCreating(ModelBuilder builder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(builder);
|
base.OnModelCreating(builder);
|
||||||
|
|
||||||
/* Include modules to your migration db context */
|
|
||||||
|
|
||||||
builder.ConfigurePermissionManagement();
|
builder.ConfigurePermissionManagement();
|
||||||
builder.ConfigureSettingManagement();
|
builder.ConfigureSettingManagement();
|
||||||
builder.ConfigureBackgroundJobs();
|
builder.ConfigureBackgroundJobs();
|
||||||
@ -81,13 +42,17 @@ public class AdminDbContext :
|
|||||||
builder.ConfigureFeatureManagement();
|
builder.ConfigureFeatureManagement();
|
||||||
builder.ConfigureTenantManagement();
|
builder.ConfigureTenantManagement();
|
||||||
|
|
||||||
/* Configure your own tables/entities inside here */
|
builder.ConfigureApplication();
|
||||||
|
}
|
||||||
|
|
||||||
//builder.Entity<YourEntity>(b =>
|
public DbSet<IdentityUser> Users { get; set; }
|
||||||
//{
|
public DbSet<IdentityRole> Roles { get; set; }
|
||||||
// b.ToTable(AdminConsts.DbTablePrefix + "YourEntities", AdminConsts.DbSchema);
|
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
|
||||||
// b.ConfigureByConvention(); //auto configure for the base class props
|
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; }
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ public class AdminDbContextFactory : IDesignTimeDbContextFactory<AdminDbContext>
|
|||||||
var configuration = BuildConfiguration();
|
var configuration = BuildConfiguration();
|
||||||
|
|
||||||
var builder = new DbContextOptionsBuilder<AdminDbContext>()
|
var builder = new DbContextOptionsBuilder<AdminDbContext>()
|
||||||
.UseNpgsql(configuration.GetConnectionString("Default"));
|
.UseNpgsql(configuration.GetConnectionString(AdminConsts.ConnectionStringName));
|
||||||
|
|
||||||
return new AdminDbContext(builder.Options);
|
return new AdminDbContext(builder.Options);
|
||||||
}
|
}
|
||||||
@ -28,8 +28,8 @@ public class AdminDbContextFactory : IDesignTimeDbContextFactory<AdminDbContext>
|
|||||||
private static IConfigurationRoot BuildConfiguration()
|
private static IConfigurationRoot BuildConfiguration()
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../KonSoft.Admin.DbMigrator/"))
|
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../../../../microservices/KonSoft.Admin.HttpApi.Host/"))
|
||||||
.AddJsonFile("appsettings.json", optional: false);
|
.AddJsonFile("appsettings.json", false);
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Volo.Abp.Threading;
|
||||||
using Volo.Abp.Identity;
|
|
||||||
using Volo.Abp.ObjectExtending;
|
|
||||||
using Volo.Abp.Threading;
|
|
||||||
|
|
||||||
namespace KonSoft.Admin.EntityFrameworkCore;
|
namespace KonSoft.Admin.EntityFrameworkCore;
|
||||||
|
|
||||||
public static class AdminEfCoreEntityExtensionMappings
|
public static class AdminEfCoreEntityExtensionMappings
|
||||||
{
|
{
|
||||||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
private static readonly OneTimeRunner OneTimeRunner = new();
|
||||||
|
|
||||||
public static void Configure()
|
public static void Configure()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Volo.Abp.Uow;
|
|
||||||
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
||||||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
|
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
|
||||||
using Volo.Abp.EntityFrameworkCore;
|
using Volo.Abp.EntityFrameworkCore;
|
||||||
@ -43,7 +42,7 @@ public class AdminEntityFrameworkCoreModule : AbpModule
|
|||||||
{
|
{
|
||||||
/* Remove "includeAllEntities: true" to create
|
/* Remove "includeAllEntities: true" to create
|
||||||
* default repositories only for aggregate roots */
|
* default repositories only for aggregate roots */
|
||||||
options.AddDefaultRepositories(includeAllEntities: true);
|
options.AddDefaultRepositories(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
Configure<AbpDbContextOptions>(options =>
|
Configure<AbpDbContextOptions>(options =>
|
||||||
@ -52,6 +51,5 @@ public class AdminEntityFrameworkCoreModule : AbpModule
|
|||||||
* See also AdminMigrationsDbContextFactory for EF Core tooling. */
|
* See also AdminMigrationsDbContextFactory for EF Core tooling. */
|
||||||
options.UseNpgsql();
|
options.UseNpgsql();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,52 +1,48 @@
|
|||||||
using KonSoft.Admin.Entities;
|
using KonSoft.Admin.Entities;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
|
using Volo.Abp.EntityFrameworkCore.Modeling;
|
||||||
|
using Volo.Abp.Identity;
|
||||||
|
|
||||||
|
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));
|
Check.NotNull(builder, nameof(builder));
|
||||||
|
|
||||||
builder.Entity<Order>(b =>
|
builder.Entity<Order>(e =>
|
||||||
{
|
{
|
||||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(Order) + AdminConsts.DbSchema);
|
e.ToTable(AdminConsts.DbTablePrefix + nameof(Order) + AdminConsts.DbSchema);
|
||||||
|
e.ConfigureByConvention();
|
||||||
|
|
||||||
b.OwnsOne(o => o.Address, a =>
|
e.ComplexProperty(b => b.Address);
|
||||||
{
|
|
||||||
a.Property(p => p.ContactName).HasColumnName("ContactName").HasMaxLength(50);
|
e.ApplyObjectExtensionMappings();
|
||||||
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 =>
|
builder.Entity<Product>(e =>
|
||||||
{
|
{
|
||||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(Worker) + AdminConsts.DbSchema);
|
e.ToTable(AdminConsts.DbTablePrefix + nameof(Product) + AdminConsts.DbSchema);
|
||||||
|
e.ConfigureByConvention();
|
||||||
|
e.ApplyObjectExtensionMappings();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Entity<HouseholdWorker>(e =>
|
||||||
builder.Entity<ServiceCategory>(b =>
|
|
||||||
{
|
{
|
||||||
b.ToTable(AdminConsts.DbTablePrefix + nameof(ServiceCategory) + AdminConsts.DbSchema);
|
e.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users" + AbpIdentityDbProperties.DbSchema);
|
||||||
|
e.ConfigureByConvention();
|
||||||
|
e.ApplyObjectExtensionMappings();
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Entity<ServiceCategory>(e =>
|
||||||
|
{
|
||||||
|
e.ToTable(AdminConsts.DbTablePrefix + nameof(ServiceCategory) + AdminConsts.DbSchema);
|
||||||
|
e.ConfigureByConvention();
|
||||||
|
e.ApplyObjectExtensionMappings();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using KonSoft.Admin.Data;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using KonSoft.Admin.Data;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
namespace KonSoft.Admin.EntityFrameworkCore;
|
namespace KonSoft.Admin.EntityFrameworkCore;
|
||||||
|
|||||||
@ -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.Entities;
|
||||||
using KonSoft.Admin.Repositories;
|
using KonSoft.Admin.IRepositories;
|
||||||
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 Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
||||||
using Volo.Abp.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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,25 +1,25 @@
|
|||||||
using KonSoft.Admin.Entities;
|
using System;
|
||||||
using KonSoft.Admin.Repositories;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using KonSoft.Admin.Entities;
|
||||||
|
using KonSoft.Admin.IRepositories;
|
||||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
||||||
using Volo.Abp.EntityFrameworkCore;
|
using Volo.Abp.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace KonSoft.Admin.EntityFrameworkCore.Repositories
|
namespace KonSoft.Admin.EntityFrameworkCore.Repositories;
|
||||||
{
|
|
||||||
public class ProductRepository : EfCoreRepository<AdminDbContext, Product>, IProductRepository
|
public class ProductRepository : EfCoreRepository<AdminDbContext, Product>, IProductRepository
|
||||||
{
|
{
|
||||||
public ProductRepository(IDbContextProvider<AdminDbContext> dbContextProvider) : base(dbContextProvider)
|
public ProductRepository(IDbContextProvider<AdminDbContext> dbContextProvider) : base(dbContextProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<Product>> GetPageRootListAsync(int skipCount, int maxResultCount, Expression<Func<Product, bool>> where)
|
public async Task<List<Product>> GetPageRootListAsync(int skipCount, int maxResultCount,
|
||||||
|
Expression<Func<Product, bool>> where)
|
||||||
{
|
{
|
||||||
var queryable = await GetQueryableAsync();
|
var queryable = await GetQueryableAsync();
|
||||||
return queryable.PageBy(skipCount, maxResultCount).Where(where).OrderBy(x => x.Order).ToList();
|
return queryable.PageBy(skipCount, maxResultCount).Where(where).OrderBy(x => x.Order).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
2294
modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.Designer.cs
generated
Normal file
2294
modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user