Skip to content

Commit dbe8dfe

Browse files
authored
refactor update to 0.9.9.0 (AlphaYu#85)
* refactor move ServiceApi/props/*.props to ServerApi * refactor remove adnc.infra.job project. * refactor remove adnc.shared.rpc.event,adnc.shared.rpc.http,adnc.shared.rpc.http,adnc.shared.const * chore change common.props path * feat add demo projects * refactor remove services projects * docs update .gitignore * docs upgrade version to 0.9.9.0 * docs add dev branches * refactor remove adnc.cust.application,adnc.cust.repositry porjects * docs upgrade to 0.9.9.0 * chore move src/ServerApi/Adnc.Demo.sln to src/ServerApi/Demo/Adnc.Demo.sln * chore change solution directory * chore change solution directory * docs update README.md * docs update README.md * docs update README.md * feat add Mapper UnitTest * docs update README.md * docs update README.md * docs update README.md * docs update README.md * docs update README.md * docs README.md * docs update README.md * CI add deploy_all.yml * CI Update deploy_all.yml * doc update README.md
1 parent 29099c6 commit dbe8dfe

File tree

428 files changed

+1804
-1998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

428 files changed

+1804
-1998
lines changed

.github/workflows/deploy_all.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: deploy_all
2+
3+
on: workflow_dispatch
4+
5+
env:
6+
RUNNER_ROOT: /home/runner/work/adnc/adnc
7+
PUBLISH_PATH: /bin/Release/net6.0/linux-x64/publish
8+
USR_IMAGE_NAME: adnc-demo-usr
9+
USR_START_FILE: "Adnc.Demo.Usr.Api.dll"
10+
USR_PROJECT_PATH: ./src/ServerApi/Demo/Usr/Adnc.Demo.Usr.Api
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v3
21+
with:
22+
dotnet-version: 6.0.x
23+
24+
- name: Deploy-Usr
25+
run: |
26+
echo "build"
27+
cd ${RUNNER_ROOT}/${USR_PROJECT_PATH}
28+
dotnet publish --configuration Release --runtime linux-x64 --self-contained false
29+
30+
cd ${RUNNER_ROOT}/${USR_PROJECT_PATH}/${PUBLISH_PATH}
31+
32+
echo "create dockerfile"
33+
touch Dockerfile
34+
echo '' > Dockerfile
35+
pwd
36+
echo "FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base" >> Dockerfile
37+
echo "WORKDIR /app" >> Dockerfile
38+
echo "COPY . /app" >> Dockerfile
39+
echo "ENTRYPOINT [ \"dotnet\",\"${USR_START_FILE}\" ]" >> Dockerfile
40+
41+
echo "build image"
42+
docker build . --file Dockerfile --tag $USR_IMAGE_NAME
43+
44+
echo "Login to registry"
45+
echo "${{ secrets.DOCKER_API_KEY }}" | docker login -u adnc --password-stdin
46+
47+
echo "Push"
48+
IMAGE_ID=${REPOSITORY}/${IMAGE_NAME}
49+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
50+
VERSION=$(date +%s)
51+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
52+
docker tag $IMAGE_NAME $IMAGE_ID:latest
53+
docker push $IMAGE_ID:$VERSION
54+
docker push $IMAGE_ID:latest

.github/workflows/nuget_infra.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
workflow_dispatch:
55
branches:
66
- master
7+
- dev
78

89
jobs:
910
build_artifact:

.github/workflows/nuget_shared.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
workflow_dispatch:
55
branches:
66
- master
7+
- dev
78

89
jobs:
910
build_artifact:

.gitignore

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ node_modules
1111
/src/ServerApi/.sonarqube
1212
/src/ServerApi/.sonarlint
1313
/src/ClientApp/target/npmlist.json
14-
/src/ServerApi/.idea/.idea.Adnc/.idea/.gitignore
15-
/src/ServerApi/.idea/.idea.Adnc/.idea/.name
16-
/src/ServerApi/.idea/.idea.Adnc/.idea/encodings.xml
17-
/src/ServerApi/.idea/.idea.Adnc/.idea/indexLayout.xml
18-
/src/ServerApi/.idea/.idea.Adnc/.idea/vcs.xml
14+
.idea
15+
/src/ServerApi/.idea
16+
/src/ServerApi/ServiceShared/.idea

README.md

+105-214
Large diffs are not rendered by default.

src/ServerApi/Adnc.sln

+103-132
Large diffs are not rendered by default.

src/ServerApi/Services/Adnc.Services.sln src/ServerApi/Demo/Adnc.Demo.sln

+186-281
Large diffs are not rendered by default.

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.WebApi/Adnc.Cust.WebApi.csproj src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Adnc.Demo.Cust.Api.csproj

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
<Import Project="..\..\..\Props\common.props" />
3-
<Import Project="..\..\..\Props\version_service.props" />
2+
<Import Project="..\..\..\common.props" />
3+
<Import Project="..\..\..\version_service.props" />
44
<PropertyGroup>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<Description>客户中心服务</Description>
77
</PropertyGroup>
88
<ItemGroup>
9-
<None Include="..\..\..\ServiceShared\Resources\**\*">
9+
<None Include="..\..\Shared\resources\**\*">
1010
<Link>%(RecursiveDir)/%(FileName)%(Extension)</Link>
1111
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1212
</None>
@@ -23,16 +23,19 @@
2323
</PackageReference>
2424
</ItemGroup>
2525

26-
27-
<ItemGroup>
28-
<ProjectReference Include="..\Adnc.Cust.Application\Adnc.Cust.Application.csproj" />
29-
</ItemGroup>
26+
<ItemGroup>
27+
<ProjectReference Include="..\..\Shared\Adnc.Demo.Shared.Rpc.Event\Adnc.Demo.Shared.Rpc.Event.csproj" />
28+
<ProjectReference Include="..\..\Shared\Adnc.Demo.Shared.Rpc.Http\Adnc.Demo.Shared.Rpc.Http.csproj" />
29+
<ProjectReference Include="..\..\Shared\Adnc.Demo.Shared.Rpc.Grpc\Adnc.Demo.Shared.Rpc.Grpc.csproj" />
30+
</ItemGroup>
3031

3132
<ItemGroup Condition="'$(SolutionName)'=='Adnc'">
33+
<ProjectReference Include="..\..\..\ServiceShared\Adnc.Shared.Application\Adnc.Shared.Application.csproj" />
3234
<ProjectReference Include="..\..\..\ServiceShared\Adnc.Shared.WebApi\Adnc.Shared.WebApi.csproj" />
3335
</ItemGroup>
3436

35-
<ItemGroup Condition="'$(SolutionName)'=='Adnc.Services' ">
37+
<ItemGroup Condition="'$(SolutionName)'=='Adnc.Demo' ">
38+
<PackageReference Include="Adnc.Shared.Application" Version="$(Shared_Version)" />
3639
<PackageReference Include="Adnc.Shared.WebApi" Version="$(Shared_Version)" />
3740
</ItemGroup>
3841

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Cache/CacheKeyBloomFilter.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Cache/CacheKeyBloomFilter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Adnc.Cust.Application.Cache;
1+
namespace Adnc.Demo.Cust.Api.Application.Cache;
22

33
public class CacheKeyBloomFilter : AbstractBloomFilter
44
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Cache/CacheService.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Cache/CacheService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Adnc.Cust.Application.Cache;
1+
namespace Adnc.Demo.Cust.Api.Application.Cache;
22

33
public sealed class CacheService : AbstractCacheService, ICachePreheatable
44
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Dtos/CustomerDto.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Dtos/CustomerDto.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Adnc.Cust.Application.Dtos;
1+
namespace Adnc.Demo.Cust.Api.Application.Dtos;
22

33
public class CustomerDto : OutputBaseAuditDto
44
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Dtos/CustomerRechargeDto.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Dtos/CustomerRechargeDto.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Adnc.Cust.Application.Dtos;
1+
namespace Adnc.Demo.Cust.Api.Application.Dtos;
22

33
public class CustomerRechargeDto : InputDto
44
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Dtos/CustomerRegisterDto.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Dtos/CustomerRegisterDto.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Adnc.Cust.Application.Dtos;
1+
namespace Adnc.Demo.Cust.Api.Application.Dtos;
22

33
public class CustomerRegisterDto : InputDto
44
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Dtos/CustomerSearchPagedDto.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Dtos/CustomerSearchPagedDto.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Adnc.Cust.Application.Dtos;
1+
namespace Adnc.Demo.Cust.Api.Application.Dtos;
22

33
public class CustomerSearchPagedDto : SearchPagedDto
44
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Dtos/DtoValidators/RechargeInputDtoValidator.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Dtos/DtoValidators/RechargeInputDtoValidator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Adnc.Cust.Application.Dtos.DtoValidators;
1+
namespace Adnc.Demo.Cust.Api.Application.Dtos.DtoValidators;
22

33
public class RechargeInputDtoValidator : AbstractValidator<CustomerRechargeDto>
44
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Services/ICustomerAppService.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Services/ICustomerAppService.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Adnc.Cust.Application.Services;
1+
using Adnc.Demo.Cust.Api.Application.Dtos;
2+
3+
namespace Adnc.Demo.Cust.Api.Application.Services;
24

35
public interface ICustomerAppService : IAppService
46
{

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Services/Implements/CustomerAppService.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Services/Implements/CustomerAppService.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
namespace Adnc.Cust.Application.Services.Implements;
1+
using Adnc.Demo.Cust.Api.Application.Cache;
2+
using Adnc.Demo.Cust.Api.Application.Dtos;
3+
using Adnc.Demo.Cust.Api.Repository;
4+
using Adnc.Demo.Cust.Api.Repository.Entities;
5+
6+
namespace Adnc.Demo.Cust.Api.Application.Services.Implements;
27

38
/// <summary>
49
/// 客户管理服务

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.Application/Subscribers/CapEventSubscriber.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Application/Subscribers/CapEventSubscriber.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Adnc.Cust.Application.Subscribers;
1+
using Adnc.Demo.Cust.Api.Repository.Entities;
2+
3+
namespace Adnc.Demo.Cust.Api.Application.Subscribers;
24

35
public sealed partial class CapEventSubscriber : ICapSubscribe
46
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
namespace Adnc.Demo.Cust.Api
2+
{
3+
public class CachingConsts
4+
{
5+
//cache key
6+
7+
//cache prefix
8+
}
9+
10+
public class PermissionConsts
11+
{
12+
public static class Customer
13+
{
14+
public const string GetList = "customerList";
15+
public const string Recharge = "customerRecharge";
16+
}
17+
}
18+
19+
public static class EntityConsts
20+
{
21+
/// <summary>
22+
/// 客户
23+
/// </summary>
24+
public static class CustomerConsts
25+
{
26+
public const int Account_MaxLength = 16;
27+
public const int Password_Maxlength = 32;
28+
public const int Nickname_MaxLength = 16;
29+
public const int Realname_Maxlength = 16;
30+
}
31+
32+
/// <summary>
33+
/// 客户财务表
34+
/// </summary>
35+
public static class CustomerFinanceConsts
36+
{
37+
public const int Account_MaxLength = 16;
38+
}
39+
40+
/// <summary>
41+
/// 客户财务变动
42+
/// </summary>
43+
public static class CustomerTransactionLogConsts
44+
{
45+
public const int Account_MaxLength = 16;
46+
public const int Remark_MaxLength = 64;
47+
}
48+
}
49+
50+
public static class RouterPath
51+
{
52+
//public const string Root = $"{SharedConsts.ShortSolutionName}/productapi";
53+
}
54+
55+
public static class ServiceConsts
56+
{
57+
public const long ProdunctStatusId = 1600000008500;
58+
public const long OrderStatusId = 1600000008600;
59+
60+
public const string AuthService = "adnc-usr-webapi";
61+
public const string UsrService = "adnc-usr-webapi";
62+
public const string MaintService = "adnc-maint-webapi";
63+
public const string CustService = "adnc-cust-webapi";
64+
public const string OrdService = "adnc-ord-webapi";
65+
public const string WhseService = "adnc-whse-webapi"; }
66+
}

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.WebApi/Controllers/CustomerController.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Controllers/CustomerController.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using Adnc.Shared.Const.Permissions.Cust;
2-
using Adnc.Shared.WebApi.Authorization;
1+
using Adnc.Demo.Cust.Api.Application.Dtos;
2+
using Adnc.Demo.Cust.Api.Application.Services;
33

4-
namespace Adnc.Cust.WebApi.Controllers;
4+
namespace Adnc.Demo.Cust.Api.Controllers;
55

66
/// <summary>
77
/// 客户管理

src/ServerApi/Services/Adnc.Cust/Adnc.Cust.WebApi/Controllers/RestAndGrpcClientDemoController.cs src/ServerApi/Demo/Cust/Adnc.Demo.Cust.Api/Controllers/RestAndGrpcClientDemoController.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using Adnc.Shared.Const;
1+
using Adnc.Demo.Cust.Api;
22

3-
namespace Adnc.Cust.WebApi.Controllers;
3+
namespace Adnc.Demo.Cust.Api.Controllers;
44

55
/// <summary>
66
/// REST and gRPC demo
77
/// </summary>
8-
[Route("cus/restandgrpcdemo")]
8+
[Route("cust/restandgrpcdemo")]
99
[ApiController]
1010
public class RestAndGrpcClientDemoController : AdncControllerBase
1111
{
@@ -113,7 +113,7 @@ public async Task<IActionResult> GetDeptListGrpcAsync()
113113
[Route("restdict")]
114114
public async Task<IActionResult> GetDictAsync()
115115
{
116-
var restResult = await _maintRestClient.GetDictAsync(ServiceAddressConsts.OrderStatusId);
116+
var restResult = await _maintRestClient.GetDictAsync(ServiceConsts.OrderStatusId);
117117
if (restResult.IsSuccessStatusCode && restResult.Content is not null)
118118
return Ok(restResult.Content);
119119
return NoContent();
@@ -127,7 +127,7 @@ public async Task<IActionResult> GetDictAsync()
127127
[Route("grpcdict")]
128128
public async Task<IActionResult> GetDictGrpcAsync()
129129
{
130-
var request = new DictRequest() { Id = ServiceAddressConsts.OrderStatusId };
130+
var request = new DictRequest() { Id = ServiceConsts.OrderStatusId };
131131
var grpcResult = await _maintGrpcClient.GetDictAsync(request, GrpcClientConsts.BasicHeader);
132132
if (grpcResult.IsSuccessStatusCode && grpcResult.Content.Is(DictReply.Descriptor))
133133
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using Adnc.Demo.Cust.Api.Application.Subscribers;
2+
using Adnc.Shared.Application.Registrar;
3+
using Adnc.Shared.WebApi.Registrar;
4+
5+
namespace Adnc.Demo.Cust.Api;
6+
7+
public sealed class ApiLayerRegistrar : AbstractWebApiDependencyRegistrar
8+
{
9+
public ApiLayerRegistrar(IServiceCollection services) : base(services)
10+
{
11+
}
12+
13+
public ApiLayerRegistrar(IApplicationBuilder appBuilder) : base(appBuilder)
14+
{
15+
}
16+
17+
public override void AddAdnc()
18+
{
19+
AddWebApiDefault();
20+
AddHealthChecks(true, true, true, false);
21+
//register others services
22+
//Services.AddScoped<xxxx>
23+
}
24+
25+
public override void UseAdnc()
26+
{
27+
UseWebApiDefault();
28+
}
29+
}
30+
31+
public sealed class ApplicationLayerRegistrar : AbstractApplicationDependencyRegistrar
32+
{
33+
private readonly Assembly _assembly;
34+
35+
public ApplicationLayerRegistrar(IServiceCollection services) : base(services)
36+
{
37+
_assembly = Assembly.GetExecutingAssembly();
38+
}
39+
40+
public override Assembly ApplicationLayerAssembly => _assembly;
41+
public override Assembly ContractsLayerAssembly => _assembly;
42+
public override Assembly RepositoryOrDomainLayerAssembly => _assembly;
43+
44+
public override void AddAdnc()
45+
{
46+
//register base services
47+
AddApplicaitonDefault();
48+
//register rpc-http services
49+
var restPolicies = PollyStrategyEnable ? this.GenerateDefaultRefitPolicies() : new();
50+
AddRestClient<IAuthRestClient>(ServiceConsts.AuthService, restPolicies);
51+
AddRestClient<IUsrRestClient>(ServiceConsts.UsrService, restPolicies);
52+
AddRestClient<IMaintRestClient>(ServiceConsts.MaintService, restPolicies);
53+
//register rpc-event service
54+
AddCapEventBus<CapEventSubscriber>();
55+
//register others services
56+
//Services.AddScoped<xxxx>
57+
}
58+
}

0 commit comments

Comments
 (0)