Browse Source

格拉默项目第一次提交

master
me 4 weeks ago
commit
dc21846886
  1. 360
      Modules/BaseService/.gitignore
  2. 53
      Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/Dto/BranchDto.cs
  3. 35
      Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/Dto/CreateOrUpdateBranchDto.cs
  4. 16
      Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/Dto/GetBranchInputDto.cs
  5. 32
      Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/IBranchAppService.cs
  6. 17
      Modules/BaseService/BaseService.Application.Contracts/BaseData/Permissions/Dto/ApplicationAuthes.cs
  7. 30
      Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/Dto/CreateOrUpdateUserBranchDto.cs
  8. 12
      Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/Dto/GetUserBranchInput.cs
  9. 38
      Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/Dto/UserBranchDto.cs
  10. 48
      Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/IUserBranchAppService.cs
  11. 20
      Modules/BaseService/BaseService.Application.Contracts/BaseService.Application.Contracts.csproj
  12. 329
      Modules/BaseService/BaseService.Application.Contracts/BaseService.Application.Contracts.xml
  13. 15
      Modules/BaseService/BaseService.Application.Contracts/BaseServiceApplicationContractsModule.cs
  14. 35
      Modules/BaseService/BaseService.Application.Contracts/Permissions/BaseServicePermissionDefinitionProvider .cs
  15. 34
      Modules/BaseService/BaseService.Application.Contracts/Permissions/BaseServicePermissions.cs
  16. 28
      Modules/BaseService/BaseService.Application.Contracts/RelationData/Dto/BranchPermissionDto.cs
  17. 30
      Modules/BaseService/BaseService.Application.Contracts/RelationData/Dto/BranchRoleDto.cs
  18. 67
      Modules/BaseService/BaseService.Application.Contracts/RelationData/IBranchRelationAppService.cs
  19. 25
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/AuditLogActionDto.cs
  20. 53
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/AuditLogDto.cs
  21. 29
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/EntityChangeDto.cs
  22. 20
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/EntityPropertyChangeDto.cs
  23. 28
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/GetAuditLogsInput.cs
  24. 11
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/GetAverageExecutionDurationPerDayInput.cs
  25. 10
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/GetAverageExecutionDurationPerDayOutput.cs
  26. 19
      Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/IAuditLoggingAppService.cs
  27. 75
      Modules/BaseService/BaseService.Application.Contracts/Systems/UserManagement/IUserAppService.cs
  28. 23
      Modules/BaseService/BaseService.Application/BaseService.Application.csproj
  29. 29
      Modules/BaseService/BaseService.Application/BaseServiceApplicationAutoMapperProfile.cs
  30. 33
      Modules/BaseService/BaseService.Application/BaseServiceApplicationModule.cs
  31. 314
      Modules/BaseService/BaseService.Application/BranchManagement/BranchAppService.cs
  32. 413
      Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs
  33. 503
      Modules/BaseService/BaseService.Application/UserManagement/UserBranchAppService.cs
  34. 14
      Modules/BaseService/BaseService.Domain/BaseData/AppIdentityRole.cs
  35. 152
      Modules/BaseService/BaseService.Domain/BaseData/Branch.cs
  36. 90
      Modules/BaseService/BaseService.Domain/BaseData/UserBranch.cs
  37. 41
      Modules/BaseService/BaseService.Domain/BaseData/UserBranchRole.cs
  38. 35
      Modules/BaseService/BaseService.Domain/BaseService.Domain.csproj
  39. 15
      Modules/BaseService/BaseService.Domain/BaseServiceConsts.cs
  40. 41
      Modules/BaseService/BaseService.Domain/BaseServiceDomainModule.cs
  41. 32
      Modules/BaseService/BaseService.Domain/BaseServiceModuleExtensionConfigurator.cs
  42. 13
      Modules/BaseService/BaseService.Domain/Localization/BaseService/cs.json
  43. 8
      Modules/BaseService/BaseService.Domain/Localization/BaseService/en.json
  44. 8
      Modules/BaseService/BaseService.Domain/Localization/BaseService/pl.json
  45. 8
      Modules/BaseService/BaseService.Domain/Localization/BaseService/pt-BR.json
  46. 8
      Modules/BaseService/BaseService.Domain/Localization/BaseService/tr.json
  47. 8
      Modules/BaseService/BaseService.Domain/Localization/BaseService/vi.json
  48. 18
      Modules/BaseService/BaseService.Domain/Localization/BaseService/zh-Hans.json
  49. 8
      Modules/BaseService/BaseService.Domain/Localization/BaseService/zh-Hant.json
  50. 9
      Modules/BaseService/BaseService.Domain/Localization/BaseServiceResource.cs
  51. 48
      Modules/BaseService/BaseService.Domain/RelationBaseData/BranchRole.cs
  52. 45
      Modules/BaseService/BaseService.Domain/Users/AppUser.cs
  53. 21
      Modules/BaseService/BaseService.EntityFrameworkCore/BaseService.EntityFrameworkCore.csproj
  54. 55
      Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseDbContextModelCreatingExtensions.cs
  55. 28
      Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseEfCoreEntityExtensionMappings.cs
  56. 61
      Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseServiceDbContext.cs
  57. 45
      Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseServiceEntityFrameworkCoreModule.cs
  58. 60
      Modules/BaseService/BaseService.Host/BaseService.Host.csproj
  59. 14
      Modules/BaseService/BaseService.Host/BaseService.Host.xml
  60. 275
      Modules/BaseService/BaseService.Host/BaseServiceHostModule.cs
  61. 13
      Modules/BaseService/BaseService.Host/Controllers/HomeController.cs
  62. 37
      Modules/BaseService/BaseService.Host/EntityFrameworkCore/BaseServiceMigrationDbContext.cs
  63. 31
      Modules/BaseService/BaseService.Host/EntityFrameworkCore/BaseServiceMigrationDbContextFactory.cs
  64. 1371
      Modules/BaseService/BaseService.Host/FileStorage/Migrations/BaseServiceMigrationDbContextModelSnapshot.cs
  65. 100
      Modules/BaseService/BaseService.Host/Migrations/20210127044859_127-2.Designer.cs
  66. 66
      Modules/BaseService/BaseService.Host/Migrations/20210127044859_127-2.cs
  67. 1370
      Modules/BaseService/BaseService.Host/Migrations/20210222060956_data0222.Designer.cs
  68. 804
      Modules/BaseService/BaseService.Host/Migrations/20210222060956_data0222.cs
  69. 1379
      Modules/BaseService/BaseService.Host/Migrations/20210228094753_data228.Designer.cs
  70. 45
      Modules/BaseService/BaseService.Host/Migrations/20210228094753_data228.cs
  71. 1373
      Modules/BaseService/BaseService.Host/Migrations/20210305072640_data20210305.Designer.cs
  72. 24
      Modules/BaseService/BaseService.Host/Migrations/20210305072640_data20210305.cs
  73. 64
      Modules/BaseService/BaseService.Host/Program.cs
  74. 27
      Modules/BaseService/BaseService.Host/Properties/launchSettings.json
  75. 20
      Modules/BaseService/BaseService.Host/Startup.cs
  76. 9
      Modules/BaseService/BaseService.Host/appsettings.Development.json
  77. 39
      Modules/BaseService/BaseService.Host/appsettings.json
  78. 14
      Modules/BaseService/BaseService.Host/src/Modules/BaseService/BaseService.Host/BaseService.Host.xml
  79. 14
      Modules/BaseService/BaseService.HttpApi.Client/BaseService.HttpApi.Client.csproj
  80. 1
      Modules/BaseService/BaseService.HttpApi/BaseData/OrganizationController.cs
  81. 70
      Modules/BaseService/BaseService.HttpApi/BaseData/UserBranchRoleController.cs
  82. 19
      Modules/BaseService/BaseService.HttpApi/BaseService.HttpApi.csproj
  83. 165
      Modules/BaseService/BaseService.HttpApi/BaseService.HttpApi.xml
  84. 21
      Modules/BaseService/BaseService.HttpApi/BaseServiceHttpApiModule.cs
  85. 13
      Modules/BaseService/BaseService.HttpApi/Controllers/BaseServiceController.cs
  86. 48
      Modules/BaseService/BaseService.HttpApi/Systems/UserController.cs
  87. 72
      Modules/BaseService/BaseService.sln
  88. 16
      Modules/BaseService/README.md
  89. 1
      Modules/新版JIT或JIS系统服务端/.gitattributes
  90. 266
      Modules/新版JIT或JIS系统服务端/.gitignore
  91. 5
      Modules/新版JIT或JIS系统服务端/.prettierrc
  92. 6
      Modules/新版JIT或JIS系统服务端/NuGet.Config
  93. BIN
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.7z
  94. BIN
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.bz2
  95. BIN
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.gz
  96. BIN
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.tar
  97. BIN
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.zip
  98. BIN
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/document/empty.docx
  99. BIN
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/document/empty.odt
  100. 12
      Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/document/empty.pdf

360
Modules/BaseService/.gitignore

@ -0,0 +1,360 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

53
Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/Dto/BranchDto.cs

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using BaseService.RelationBaseData;
using Volo.Abp.Application.Dtos;
namespace BaseService.BaseData.BranchManagement.Dto
{
public class BranchDto : EntityDto<Guid>
{
public short CategoryId { get; set; }
public Guid? Pid { get; set; }
public string Name { get; set; }
public string FullName { get; set; }
public int Sort { get; set; }
public bool Enabled { get; set; }
public bool HasChildren { get; set; }
public bool Leaf { get; set; }
#region >扩展字段<
public string Label { get; set; }
#endregion
public virtual ICollection<BranchRole> Roles { get; set; }
//public short CategoryId { get; set; }
//public Guid? Pid { get; set; }
//public string Name { get; set; }
//public string FullName { get; set; }
//public int Sort { get; set; }
//public bool Enabled { get; set; }
//public bool HasChildren { get; set; }
//public bool Leaf { get; set; }
//#region >扩展字段<
//public string Label { get; set; }
//#endregion
//public virtual ICollection<BranchRole> Roles { get; set; }
}
}

35
Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/Dto/CreateOrUpdateBranchDto.cs

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using BaseService.RelationBaseData;
namespace BaseService.BaseData.BranchManagement.Dto
{/// <summary>
/// 分支DTO
/// </summary>
public class CreateOrUpdateBranchDto
{
public short CategoryId { get; set; }
/// <summary>
/// 子分支ID
/// </summary>
public Guid? Pid { get; set; }
/// <summary>
/// 分支名称
/// </summary>
[Required]
public string Name { get; set; }
/// <summary>
/// 分类
/// </summary>
public int Sort { get; set; }
/// <summary>
/// 是否可用
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// 对应的角色列表
/// </summary>
public virtual ICollection<BranchRole> Roles { get; set; }
}
}

16
Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/Dto/GetBranchInputDto.cs

@ -0,0 +1,16 @@
using System;
using Volo.Abp.Application.Dtos;
namespace BaseService.BaseData.BranchManagement.Dto
{
public class GetBranchInputDto : PagedAndSortedResultRequestDto
{
public Guid? Id { get; set; }
public string Filter { get; set; }
public short? CategoryId { get; set; }
public Guid? Pid { get; set; }
}
}

32
Modules/BaseService/BaseService.Application.Contracts/BaseData/BranchManagement/IBranchAppService.cs

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BaseService.BaseData.BranchManagement.Dto;
using BaseService.RelationData.Dto;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
namespace BaseService.BaseData.BranchManagement
{
public interface IBranchAppService : IApplicationService
{
Task<PagedResultDto<BranchDto>> GetPagedListAsync(GetBranchInputDto input);
Task<ListResultDto<BranchDto>> GetAllAsync(Guid? id, string filter);
Task<ListResultDto<BranchDto>> GetChildrenAsync();
Task<BranchDto> GetAsync(Guid id);
Task<BranchDto> CreateAsync(CreateOrUpdateBranchDto input);
Task<BranchDto> UpdateAsync(Guid id, CreateOrUpdateBranchDto input);
Task DeleteAsync(List<Guid> ids);
Task<ListResultDto<BranchRoleDto>> GetRolesAsync(Guid branchId);
Task<PagedResultDto<IdentityRoleDto>> GetPagedRolesAsync(Guid branchId, PagedAndSortedResultRequestDto input);
}
}

17
Modules/BaseService/BaseService.Application.Contracts/BaseData/Permissions/Dto/ApplicationAuthes.cs

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace BaseService.BaseData.Permissions.Dto
{
public class ApplicationAuthes
{
public Dictionary<string, bool> Policies { get; set; }
public Dictionary<string, bool> GrantedPolicies { get; set; }
public ApplicationAuthes()
{
Policies = new Dictionary<string, bool>();
GrantedPolicies = new Dictionary<string, bool>();
}
}
}

30
Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/Dto/CreateOrUpdateUserBranchDto.cs

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Volo.Abp.Identity;
namespace BaseService.BaseData.UserBranchRoleManagement.Dto
{
public class CreateOrUpdateUserBranchDto
{
/// <summary>
/// 主键
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// 用户ID
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// 分支ID
/// </summary>
public Guid BranchId { get; set; }
/// <summary>
/// 角色列表
/// </summary>
public virtual ICollection<UserBranchRole> Roles { get; set; } = new Collection<UserBranchRole>();
}
}

12
Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/Dto/GetUserBranchInput.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp.Application.Dtos;
namespace BaseService.BaseData.UserBranchRoleManagement.Dto
{
public class GetUserBranchInput : PagedAndSortedResultRequestDto
{
public Guid? UserId { get; set; }
public Guid? BranchId { get; set; }
public string Filter { get; set; }
}
}

38
Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/Dto/UserBranchDto.cs

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations.Schema;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.MultiTenancy;
namespace BaseService.BaseData.UserBranchRoleManagement.Dto
{
public class UserBranchDto : EntityDto<Guid>
{
/// <summary>
/// 用户ID
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// 用户名称
/// </summary>
[NotMapped]
public string UserName { get; set; }
/// <summary>
/// 分支ID
/// </summary>
public Guid BranchId { get; set; }
/// <summary>
/// 分支机构名称
/// </summary>
[NotMapped]
public string BranchName { get; set; }
public virtual ICollection<UserBranchRole> Roles { get; set; } = new Collection<UserBranchRole>();
}
}

48
Modules/BaseService/BaseService.Application.Contracts/BaseData/UserBranchRoleManagement/IUserBranchAppService.cs

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BaseService.BaseData.Permissions.Dto;
using BaseService.BaseData.UserBranchRoleManagement.Dto;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace BaseService.BaseData.UserBranchRoleManagement
{
/// <summary>
/// 用户--分支--角色
/// </summary>
public interface IUserBranchAppService : IApplicationService
{
Task<PagedResultDto<UserBranchDto>> GetPagedListAsync(GetUserBranchInput input);
Task<UserBranchDto> GetAsync(Guid id);
//Task<UserBranchDto> CreateAsync(CreateOrUpdateUserBranchDto input);
Task CreateUpdateAsync(CreateOrUpdateUserBranchDto input);
Task<UserBranchDto> UpdateAsync(Guid id, CreateOrUpdateUserBranchDto input);
Task DeleteAsync(List<Guid> ids);
Task<List<UserBranchDto>> GetUserBranchsAsync(Guid userId);
Task<List<UserBranchDto>> GetCurrentUserBranchesAsync();
Task<ApplicationAuthes> GetAuthConfigAsync(Guid branchId);
Task<List<UserBranchRole>> GetUserRolesAsync(Guid userId,Guid branchId);
Task DeleteUnitAsync(Guid userId, Guid branchId);
//Task<List<UserBranchRole>> GetBranchRolesAsync(Guid branchId);
List<UserBranchRole> GetBranchRolesAsync(Guid branchId);
//Task<List<UserBranchRole>> GetUserRolesAsync(Guid userId);
List<UserBranchRole> GetUserRolesAsync(Guid userId);
Task<UserBranchDto> GetCurrentUserBranchAsync(Guid userId);
Task DeleteUnitAsync(Guid userId);
}
}

20
Modules/BaseService/BaseService.Application.Contracts/BaseService.Application.Contracts.csproj

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>BaseService</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application.Contracts" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseService.Domain\BaseService.Domain.csproj" />
</ItemGroup>
</Project>

329
Modules/BaseService/BaseService.Application.Contracts/BaseService.Application.Contracts.xml

@ -0,0 +1,329 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>BaseService.Application.Contracts</name>
</assembly>
<members>
<member name="T:BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto">
<summary>
分支DTO
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto.Pid">
<summary>
子分支ID
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto.Name">
<summary>
分支名称
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto.Sort">
<summary>
分类
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto.Enabled">
<summary>
是否可用
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto.Roles">
<summary>
对应的角色列表
</summary>
</member>
<member name="T:BaseService.BaseData.BranchManagement.Dto.GetBranchInputDto">
<summary>
获取分支信息
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.GetBranchInputDto.Id">
<summary>
传入分支ID
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.GetBranchInputDto.Filter">
<summary>
过滤条件
</summary>
</member>
<member name="P:BaseService.BaseData.BranchManagement.Dto.GetBranchInputDto.Pid">
<summary>
子分支ID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.CreateOrUpdateUserBranchRoleDto.Id">
<summary>
自身的GUID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.CreateOrUpdateUserBranchRoleDto.TenantId">
<summary>
租户
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.CreateOrUpdateUserBranchRoleDto.UserId">
<summary>
用户ID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.CreateOrUpdateUserBranchRoleDto.BranchId">
<summary>
分支ID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.CreateOrUpdateUserBranchRoleDto.RoleId">
<summary>
角色ID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.UserBranchRoleDto.TenantId">
<summary>
租户
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.UserBranchRoleDto.UserId">
<summary>
用户ID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.UserBranchRoleDto.UserIdToName">
<summary>
用户名称
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.UserBranchRoleDto.BranchId">
<summary>
分支ID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.UserBranchRoleDto.BranchIdToName">
<summary>
分支机构名称
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.UserBranchRoleDto.RoleId">
<summary>
角色ID
</summary>
</member>
<member name="P:BaseService.BaseData.UserBranchRoleManagement.Dto.UserBranchRoleDto.RoleIdToName">
<summary>
角色名称
</summary>
</member>
<member name="T:BaseService.BaseData.UserBranchRoleManagement.IUserBranchRoleAppService">
<summary>
用户--分支--角色
</summary>
</member>
<member name="P:BaseService.RelationBaseData.BranchAndRole.Dto.MyBranchUnitRoleDto.TenantId">
<summary>
TenantId of this entity.
</summary>
</member>
<member name="P:BaseService.RelationBaseData.BranchAndRole.Dto.MyBranchUnitRoleDto.RoleId">
<summary>
Id of the Role.
</summary>
</member>
<member name="P:BaseService.RelationBaseData.BranchAndRole.Dto.MyBranchUnitRoleDto.BranchUnitId">
<summary>
Id of the <see cref="!:BranchUnit"/>.
</summary>
</member>
<member name="P:BaseService.RelationBaseData.BranchAndRole.Dto.BranchUnitPermissionDto.BranchId">
<summary>
分支ID
</summary>
</member>
<member name="P:BaseService.RelationBaseData.BranchAndRole.Dto.BranchUnitPermissionDto.BranchIdToName">
<summary>
分支机构名称
</summary>
</member>
<member name="P:BaseService.RelationBaseData.BranchAndRole.Dto.BranchUnitPermissionDto.PermissName">
<summary>
权限名称
</summary>
</member>
<member name="P:BaseService.RelationBaseData.BranchAndRole.Dto.BranchUnitPermissionDto.ProviderKey">
<summary>
角色名称
</summary>
</member>
<member name="T:BaseService.RelationData.IBranchRelationAppService">
<summary>
分支接口:无权限设置调用
</summary>
</member>
<member name="M:BaseService.RelationData.IBranchRelationAppService.GetAll(BaseService.BaseData.BranchManagement.Dto.GetBranchInputDto)">
<summary>
获取所有分支
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IBranchRelationAppService.LoadAll(System.Nullable{System.Guid},System.String)">
<summary>
加载所有分支
</summary>
<param name="id"></param>
<param name="filter"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IBranchRelationAppService.LoadAllNodes">
<summary>
加载所有分支子节点
</summary>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IBranchRelationAppService.Get(System.Guid)">
<summary>
获取单条分支信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IBranchRelationAppService.Create(BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto)">
<summary>
创建分支信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IBranchRelationAppService.Update(System.Guid,BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto)">
<summary>
更新分支信息
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IBranchRelationAppService.Delete(System.Collections.Generic.List{System.Guid})">
<summary>
删除分支信息
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="T:BaseService.RelationData.IUserRelationAppService">
<summary>
用户信息:无权限设置
</summary>
</member>
<member name="M:BaseService.RelationData.IUserRelationAppService.Get(System.Guid)">
<summary>
根据ID获取单条信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IUserRelationAppService.GetCurrentUserInfo">
<summary>
获取当前登录用户信息
</summary>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IUserRelationAppService.GetAll(Volo.Abp.Identity.GetIdentityUsersInput)">
<summary>
获取所有用户信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IUserRelationAppService.LoadAllBranchesByUserId(System.Guid)">
<summary>
根据分支ID获取用户信息
</summary>
<param name="rolesbyuserId"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IUserRelationAppService.GetAuthConfigAsync(System.Guid)">
<summary>
获取权限列表信息
</summary>
<param name="branchId"></param>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IUserRelationAppService.LoadAllCurrentUserBranches">
<summary>
获取当前登录用户的所有分支信息
</summary>
<returns></returns>
</member>
<member name="M:BaseService.RelationData.IUserRelationAppService.ResetPasswordCurrentUser(System.Guid)">
<summary>
重置当前登录用户的密码
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.Get(System.Guid)">
<summary>
根据ID获取单条信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.GetCurrentUserInfo">
<summary>
获取当前登录用户信息
</summary>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.Create(Volo.Abp.Identity.IdentityUserCreateDto)">
<summary>
创建用户
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.UpdateAsync(System.Guid,Volo.Abp.Identity.IdentityUserUpdateDto)">
<summary>
更新用户信息
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.GetAll(Volo.Abp.Identity.GetIdentityUsersInput)">
<summary>
获取所有用户信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.LoadAllBranchesByUserId(System.Guid)">
<summary>
根据分支ID获取用户信息
</summary>
<param name="rolesbyuserId"></param>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.GetAuthConfigAsync(System.Guid)">
<summary>
获取权限列表信息
</summary>
<param name="branchId"></param>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.LoadAllCurrentUserBranches">
<summary>
获取当前登录用户的所有分支信息
</summary>
<returns></returns>
</member>
<member name="M:BaseService.Systems.UserManagement.IUserAppService.ResetPasswordCurrentUser(System.Guid)">
<summary>
重置当前登录用户的密码
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
</members>
</doc>

15
Modules/BaseService/BaseService.Application.Contracts/BaseServiceApplicationContractsModule.cs

@ -0,0 +1,15 @@
using Volo.Abp.Application;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
namespace BaseService
{
[DependsOn(
typeof(BaseServiceDomainModule),
typeof(AbpDddApplicationModule),
typeof(AbpPermissionManagementApplicationContractsModule)
)]
public class BaseServiceApplicationContractsModule : AbpModule
{
}
}

35
Modules/BaseService/BaseService.Application.Contracts/Permissions/BaseServicePermissionDefinitionProvider .cs

@ -0,0 +1,35 @@
using BaseService.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
namespace BaseService.Permissions
{
public class BaseServicePermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var baseService = context.AddGroup(BaseServicePermissions.BaseService, L("BaseService"), MultiTenancySides.Tenant);
var auditLogging = baseService.AddPermission(BaseServicePermissions.AuditLogging.Default, L("AuditLogging"));
var branch = baseService.AddPermission(BaseServicePermissions.Branch.Default,L("Branch"));
branch.AddChild(BaseServicePermissions.Branch.Update, L("Edit"));
branch.AddChild(BaseServicePermissions.Branch.Delete, L("Delete"));
branch.AddChild(BaseServicePermissions.Branch.Create, L("Create"));
var userBranch = baseService.AddPermission(BaseServicePermissions.UserBranch.Default, L("UserBranch"));
userBranch.AddChild(BaseServicePermissions.UserBranch.Update, L("Edit"));
userBranch.AddChild(BaseServicePermissions.UserBranch.Delete, L("Delete"));
userBranch.AddChild(BaseServicePermissions.UserBranch.Create, L("Create"));
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<BaseServiceResource>(name);
}
}
}

34
Modules/BaseService/BaseService.Application.Contracts/Permissions/BaseServicePermissions.cs

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BaseService.Permissions
{
public static class BaseServicePermissions
{
public const string BaseService = "BaseService";
public static class AuditLogging
{
public const string Default = BaseService + ".AuditLogging";
}
public static class Branch
{
public const string Default = BaseService + ".Branch";
public const string Delete = Default + ".Delete";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
}
public static class UserBranch
{
public const string Default = BaseService + ".UserBranch";
public const string Delete = Default + ".Delete";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
}
}
}

28
Modules/BaseService/BaseService.Application.Contracts/RelationData/Dto/BranchPermissionDto.cs

@ -0,0 +1,28 @@
using System;
namespace BaseService.RelationData.Dto
{
public class BranchPermissionDto
{
/// <summary>
/// 分支ID
/// </summary>
public Guid BranchId { get; set; }
/// <summary>
/// 分支机构名称
/// </summary>
public string BranchIdToName { get; set; }
/// <summary>
/// 权限名称
/// </summary>
public string PermissName { get; set; }
/// <summary>
/// 角色名称
/// </summary>
public string ProviderKey { get; set; }
}
}

30
Modules/BaseService/BaseService.Application.Contracts/RelationData/Dto/BranchRoleDto.cs

@ -0,0 +1,30 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace BaseService.RelationData.Dto
{
public class BranchRoleDto : CreationAuditedEntity
{
/// <summary>
/// Id of the Role.
/// </summary>
public Guid RoleId { get; set; }
public string RoleName { get; set; }
/// <summary>
/// Id of the <see cref="Branch"/>.
/// </summary>
public Guid BranchId { get; set; }
public string BranchName { get; set; }
public override object[] GetKeys()
{
return new object[] { BranchId, RoleId };
}
}
}

67
Modules/BaseService/BaseService.Application.Contracts/RelationData/IBranchRelationAppService.cs

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using BaseService.BaseData.BranchManagement.Dto;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
namespace BaseService.RelationData
{
/// <summary>
/// 分支接口:无权限设置调用
/// </summary>
public interface IBranchRelationAppService : IApplicationService
{
/// <summary>
/// 获取所有分支
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<PagedResultDto<BranchDto>> GetPagedAsync(GetBranchInputDto input);
/// <summary>
/// 加载所有分支
/// </summary>
/// <param name="id"></param>
/// <param name="filter"></param>
/// <returns></returns>
Task<ListResultDto<BranchDto>> GetChildrenAsync(Guid? id, string filter);
/// <summary>
/// 加载所有分支子节点
/// </summary>
/// <returns></returns>
Task<ListResultDto<BranchDto>> GetAllAsync();
/// <summary>
/// 获取单条分支信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<BranchDto> GetAsync(Guid id);
/// <summary>
/// 创建分支信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<BranchDto> CreateAsync(CreateOrUpdateBranchDto input);
/// <summary>
/// 更新分支信息
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
Task<BranchDto> UpdateAsync(Guid id, CreateOrUpdateBranchDto input);
/// <summary>
/// 删除分支信息
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task DeleteAsync(List<Guid> ids);
}
}

25
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/AuditLogActionDto.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
namespace BaseService.Systems.AuditLoggingManagement.Dto
{
public class AuditLogActionDto : EntityDto<Guid>
{
public Guid? TenantId { get; set; }
public Guid AuditLogId { get; set; }
public string ServiceName { get; set; }
public string MethodName { get; set; }
public string Parameters { get; set; }
public DateTime ExecutionTime { get; set; }
public int ExecutionDuration { get; set; }
public Dictionary<string, object> ExtraProperties { get; set; }
}
}

53
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/AuditLogDto.cs

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Volo.Abp.Application.Dtos;
namespace BaseService.Systems.AuditLoggingManagement.Dto
{
public class AuditLogDto : EntityDto<Guid>
{
public virtual string ApplicationName { get; set; }
public virtual Guid? UserId { get; set; }
public virtual string UserName { get; set; }
public virtual Guid? TenantId { get; set; }
public virtual string TenantName { get; set; }
public virtual Guid? ImpersonatorUserId { get; set; }
public virtual Guid? ImpersonatorTenantId { get; set; }
public virtual DateTime ExecutionTime { get; set; }
public virtual int ExecutionDuration { get; set; }
public virtual string ClientIpAddress { get; set; }
public virtual string ClientName { get; set; }
public virtual string ClientId { get; set; }
public virtual string CorrelationId { get; set; }
public virtual string BrowserInfo { get; set; }
public virtual string HttpMethod { get; set; }
public virtual string Url { get; set; }
public virtual string Exceptions { get; set; }
public virtual string Comments { get; set; }
public virtual int? HttpStatusCode { get; set; }
public virtual Dictionary<string, object> ExtraProperties { get; set; }
public virtual Collection<EntityChangeDto> EntityChanges { get; protected set; }
public virtual Collection<AuditLogActionDto> Actions { get; protected set; }
}
}

29
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/EntityChangeDto.cs

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Auditing;
namespace BaseService.Systems.AuditLoggingManagement.Dto
{
public class EntityChangeDto : EntityDto<Guid>
{
public Guid AuditLogId { get; set; }
public Guid? TenantId { get; set; }
public DateTime ChangeTime { get; set; }
public EntityChangeType ChangeType { get; set; }
public Guid? EntityTenantId { get; set; }
public string EntityId { get; set; }
public string EntityTypeFullName { get; set; }
public Collection<EntityPropertyChangeDto> PropertyChanges { get; set; }
public Dictionary<string, object> ExtraProperties { get; set; }
}
}

20
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/EntityPropertyChangeDto.cs

@ -0,0 +1,20 @@
using System;
using Volo.Abp.Application.Dtos;
namespace BaseService.Systems.AuditLoggingManagement.Dto
{
public class EntityPropertyChangeDto : EntityDto<Guid>
{
public Guid? TenantId { get; set; }
public Guid EntityChangeId { get; set; }
public string NewValue { get; set; }
public string OriginalValue { get; set; }
public string PropertyName { get; set; }
public string PropertyTypeFullName { get; set; }
}
}

28
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/GetAuditLogsInput.cs

@ -0,0 +1,28 @@
using System.Net;
using Volo.Abp.Application.Dtos;
namespace BaseService.Systems.AuditLoggingManagement.Dto
{
public class GetAuditLogsInput : PagedResultRequestDto, IPagedAndSortedResultRequest, IPagedResultRequest, ILimitedResultRequest
{
public string Sorting { get; set; }
public string Url { get; set; }
public string UserName { get; set; }
public string ApplicationName { get; set; }
public string CorrelationId { get; set; }
public string HttpMethod { get; set; }
public HttpStatusCode? HttpStatusCode { get; set; }
public int? MaxExecutionDuration { get; set; }
public int? MinExecutionDuration { get; set; }
public bool HasException { get; set; }
}
}

11
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/GetAverageExecutionDurationPerDayInput.cs

@ -0,0 +1,11 @@
using System;
namespace BaseService.Systems.AuditLoggingManagement.Dto
{
public class GetAverageExecutionDurationPerDayInput
{
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
}
}

10
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/Dto/GetAverageExecutionDurationPerDayOutput.cs

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
namespace BaseService.Systems.AuditLoggingManagement.Dto
{
public class GetAverageExecutionDurationPerDayOutput
{
public Dictionary<DateTime, double> Data { get; set; }
}
}

19
Modules/BaseService/BaseService.Application.Contracts/Systems/AuditLoggingManagement/IAuditLoggingAppService.cs

@ -0,0 +1,19 @@
using BaseService.Systems.AuditLoggingManagement.Dto;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace BaseService.Systems.AuditLoggingManagement
{
public interface IAuditLoggingAppService : IApplicationService
{
Task<AuditLogDto> Get(Guid id);
Task<PagedResultDto<AuditLogDto>> GetAll(GetAuditLogsInput input);
Task<GetAverageExecutionDurationPerDayOutput> GetAverageExecutionDurationPerDay(GetAverageExecutionDurationPerDayInput input);
}
}

75
Modules/BaseService/BaseService.Application.Contracts/Systems/UserManagement/IUserAppService.cs

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using BaseService.BaseData.Permissions.Dto;
using BaseService.RelationData.Dto;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
namespace BaseService.Systems.UserManagement
{
public interface IUserAppService : IApplicationService
{
/// <summary>
/// 根据ID获取单条信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<IdentityUserDto> GetAsync(Guid id);
/// <summary>
/// 获取当前登录用户信息
/// </summary>
/// <returns></returns>
Task<IdentityUserDto> GetCurrentUserAsync();
/// <summary>
/// 创建用户
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input);
/// <summary>
/// 更新用户信息
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
Task<IdentityUserDto> UpdateAsync(Guid id, IdentityUserUpdateDto input);
/// <summary>
/// 获取所有用户信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<PagedResultDto<IdentityUserDto>> GetAll(GetIdentityUsersInput input);
/// <summary>
/// 根据分支ID获取用户信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
Task<ListResultDto<BranchRoleDto>> GetUserBranchesAsync(Guid userId);
/// <summary>
/// 获取权限列表信息
/// </summary>
/// <param name="branchId"></param>
/// <returns></returns>
Task<ApplicationAuthes> GetAuthConfigAsync(Guid branchId);
/// <summary>
/// 重置当前登录用户的密码
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
//Task<IdentityUserDto> ResetPasswordCurrentUser(Guid id, IdentityUserCreateDto input);
Task<IdentityUserDto> ResetPasswordAsync(Guid id);
}
}

23
Modules/BaseService/BaseService.Application/BaseService.Application.csproj

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>BaseService</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Shared\Win.Sfs.Shared\Win.Sfs.Shared.csproj" />
<ProjectReference Include="..\..\..\Shared\Win.Utils\Win.Utils.csproj" />
<ProjectReference Include="..\BaseService.Application.Contracts\BaseService.Application.Contracts.csproj" />
</ItemGroup>
</Project>

29
Modules/BaseService/BaseService.Application/BaseServiceApplicationAutoMapperProfile.cs

@ -0,0 +1,29 @@
using AutoMapper;
using BaseService.BaseData;
using BaseService.RelationBaseData;
using BaseService.Systems.AuditLoggingManagement.Dto;
using System;
using System.Collections.Generic;
using System.Text;
using BaseService.BaseData.BranchManagement.Dto;
using BaseService.BaseData.UserBranchRoleManagement.Dto;
using BaseService.RelationData.Dto;
namespace BaseService
{
public class BaseServiceApplicationAutoMapperProfile : Profile
{
public BaseServiceApplicationAutoMapperProfile()
{
CreateMap<Branch, BranchDto>()
.ForMember(dto => dto.Label, opt => opt.MapFrom(src => src.Name));
//用户--分支
CreateMap<UserBranch, UserBranchDto>();
//分支--角色
CreateMap<BranchRole, BranchRoleDto>();
}
}
}

33
Modules/BaseService/BaseService.Application/BaseServiceApplicationModule.cs

@ -0,0 +1,33 @@
using Volo.Abp.AutoMapper;
using Volo.Abp.Identity;
using Volo.Abp.Json;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
namespace BaseService
{
[DependsOn(
typeof(BaseServiceApplicationContractsModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpAutoMapperModule)
)]
public class BaseServiceApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<BaseServiceApplicationAutoMapperProfile>();
});
}
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpJsonOptions>(option =>
{
option.UseHybridSerializer = false;
});
}
}
}

314
Modules/BaseService/BaseService.Application/BranchManagement/BranchAppService.cs

@ -0,0 +1,314 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using BaseService.BaseData.BranchManagement.Dto;
using BaseService.BaseData.UserBranchRoleManagement.Dto;
using BaseService.Permissions;
using BaseService.RelationBaseData;
using BaseService.RelationData.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Win.Sfs.Shared.CacheBase;
namespace BaseService.BaseData.BranchManagement
{
[Route("api/base/branch")]
[Authorize(BaseServicePermissions.Branch.Default)]
public class BranchAppService : ApplicationService, IBranchAppService
{
private readonly IRepository<Branch, Guid> _repository;
private readonly IRepository<UserBranch> _repositoryBranchRole;
public IIdentityRoleRepository RoleRepository { get; }
private readonly IDistributedCache<Branch> _cache;
public BranchAppService(IRepository<Branch, Guid> repository,
IRepository<UserBranch> repositoryBranchRole,
IDistributedCache<Branch> cache,
IIdentityRoleRepository roleRepository)
{
_repository = repository;
_repositoryBranchRole = repositoryBranchRole;
RoleRepository = roleRepository;
_cache = cache;
}
[HttpPost]
[Authorize(BaseServicePermissions.Branch.Create)]
public virtual async Task<BranchDto> CreateAsync(CreateOrUpdateBranchDto input)
{
var exist = await _repository.FirstOrDefaultAsync(_ => _.Name == input.Name);
if (exist != null) throw new BusinessException("名称:" + input.Name + "机构已存在");
var branch = new Branch(GuidGenerator.Create(),
CurrentTenant.Id,
input.CategoryId,
input.Pid,
input.Name,
"",
input.Sort,
true,
input.Enabled
);
var parent = await _repository.FirstOrDefaultAsync(_ => _.Id == input.Pid);
ChangeOrganizationModel(branch, parent);
await _repository.InsertAsync(branch);
//create cache
await _cache.SetAsync(branch.Id.ToString(), branch, CacheStrategyConst.FIVE_MINUTES);
return ObjectMapper.Map<Branch, BranchDto>(branch);
}
[HttpPost]
[Route("delete")]
[Authorize(BaseServicePermissions.Branch.Delete)]
public virtual async Task DeleteAsync(List<Guid> ids)
{
foreach (var id in ids)
{
var branch = await _repository.GetAsync(id);
await _repository.DeleteAsync(_ => _.CascadeId.Contains(branch.CascadeId));
await _cache.DeleteAsync(id.ToString());
await _repository.DeleteAsync(_ => _.Id == id);
}
}
[HttpGet]
[Route("{id}")]
[AllowAnonymous]
public virtual async Task<BranchDto> GetAsync(Guid id)
{
var result = await GetFromCacheAsync(id);
return ObjectMapper.Map<Branch, BranchDto>(result);
}
protected virtual async Task<Branch> GetFromCacheAsync(Guid id)
{
var result = await _cache.GetOrAddAsync(
id.ToString(),
async () => await GetFromRepository(id),
CacheStrategyConst.FIVE_MINUTES);
return result;
}
private async Task<Branch> GetFromRepository(Guid id)
{
return await _repository.GetAsync(id);
}
[HttpGet]
[Route("paged")]
public virtual async Task<PagedResultDto<BranchDto>> GetPagedListAsync(GetBranchInputDto input)
{
var query = _repository
.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), _ => _.Name.Contains(input.Filter))
.WhereIf(input.CategoryId.HasValue, _ => _.CategoryId == input.CategoryId);
if (input.Id.HasValue)
{
var org = await _repository.GetAsync(input.Id.Value);
query = query.Where(_ => _.CascadeId.Contains(org.CascadeId));
}
var items = await query.OrderBy(input.Sorting ?? "Sort")
.Skip(input.SkipCount)
.Take(input.MaxResultCount)
.ToListAsync();
var totalCount = await query.CountAsync();
var dtos = ObjectMapper.Map<List<Branch>, List<BranchDto>>(items);
return new PagedResultDto<BranchDto>(totalCount, dtos);
//var query = _repository
// .WhereIf(!string.IsNullOrWhiteSpace(input.Filter), _ => _.Name.Contains(input.Filter))
// .WhereIf(input.CategoryId.HasValue, _ => _.CategoryId == input.CategoryId);
//var items = await query.OrderBy(input.Sorting ?? "Sort")
// .Skip(input.SkipCount)
// .Take(input.MaxResultCount)
// .ToListAsync();
//var totalCount = await query.CountAsync();
//var dtos = ObjectMapper.Map<List<Branch>, List<BranchDto>>(items);
//return new PagedResultDto<BranchDto>(totalCount, dtos);
}
[HttpGet]
[Route("all")]
public virtual async Task<ListResultDto<BranchDto>> GetAllAsync(Guid? id, string filter)
{
var items = new List<Branch>();
if (!string.IsNullOrWhiteSpace(filter))
{
items = await _repository.Where(_ => _.Name.Contains(filter)).ToListAsync();
}
else
{
var query = id.HasValue ? _repository.Where(_ => _.Pid == id) :
_repository.Where(_ => _.Pid == null);
items = await query.ToListAsync();
}
var dtos = ObjectMapper.Map<List<Branch>, List<BranchDto>>(items);
return new ListResultDto<BranchDto>(dtos);
}
[HttpGet]
[Route("children")]
public virtual async Task<ListResultDto<BranchDto>> GetChildrenAsync()
{
var items = await _repository.GetListAsync();
var dtos = ObjectMapper.Map<List<Branch>, List<BranchDto>>(items);
return new ListResultDto<BranchDto>(dtos);
}
[HttpPut]
[Route("{id}")]
[Authorize(BaseServicePermissions.Branch.Update)]
public virtual async Task<BranchDto> UpdateAsync(Guid id, CreateOrUpdateBranchDto input)
{
if (input.Pid == id) throw new BusinessException("机构上级不能为当前机构!");
var branch = await _repository.FirstOrDefaultAsync(_ => _.Id == id);
if (branch.Pid != input.Pid)
{
var parent = await _repository.FirstOrDefaultAsync(_ => _.Id == input.Pid);
var orgs = await _repository.Where(_ => _.CascadeId.Contains(branch.CascadeId) && _.Id != branch.Id)
.OrderBy(_ => _.CascadeId).ToListAsync();
branch.Pid = input.Pid;
ChangeOrganizationModel(branch, parent);
foreach (var org in orgs)
{
if (org.Pid == branch.Id)
{
ChangeOrganizationModel(org, branch, false);
}
else
{
var orgParent = orgs.FirstOrDefault(_ => _.Id == org.Pid);
ChangeOrganizationModel(org, orgParent, false);
}
}
}
branch.Name = input.Name;
branch.Sort = input.Sort;
branch.Enabled = input.Enabled;
await _cache.SetAsync(id.ToString(), branch, CacheStrategyConst.FIVE_MINUTES);
return ObjectMapper.Map<Branch, BranchDto>(branch);
}
private void ChangeOrganizationModel(Branch org, Branch parent, bool checkLevel = true)
{
var cascadeId = org.CascadeId == null ? 1 : int.Parse(org.CascadeId.TrimEnd('.').Split('.').Last());
if (checkLevel)
{
if (parent != null && parent.Leaf) parent.Leaf = false;
var lastLevel = _repository.Where(_ => _.Pid == org.Pid && _.Id != org.Id)
.OrderByDescending(_ => _.CascadeId)
.FirstOrDefault();
cascadeId = lastLevel == null ? 1 : int.Parse(lastLevel.CascadeId.TrimEnd('.').Split('.').Last()) + 1;
}
if (org.Pid.HasValue)
{
if (parent == null) throw new BusinessException("上级机构查询错误!");
org.CascadeId = parent.CascadeId + cascadeId + ".";
org.FullName = parent.FullName + "/" + org.Name;
}
else
{
org.CascadeId = ".0." + cascadeId + ".";
org.FullName = org.Name;
}
}
/// <summary>
/// 根据分支ID,查找中间表branch-role
/// </summary>
/// <param name="branchId"></param>
/// <returns></returns>
[HttpGet]
[Route("{branchId}/roles")]
public virtual async Task<ListResultDto<BranchRoleDto>> GetRolesAsync(Guid branchId)
{
var dtos = new List<BranchRoleDto>();
var getRoleIds = await GetRolesByBranchIdAsync(branchId);
var roles = await RoleRepository.GetListAsync();
if (getRoleIds != null)
{
foreach (var role in getRoleIds)
{
dtos.Add(new BranchRoleDto() { RoleId = role.RoleId, RoleName = roles.FirstOrDefault(p => p.Id == role.RoleId)?.Name });
}
}
return new ListResultDto<BranchRoleDto>(dtos);
}
protected virtual async Task<List<UserBranchRole>> GetRolesByBranchIdAsync(Guid branchId)
{
var userBranch = await _repositoryBranchRole.GetAsync(_ => _.BranchId == branchId);
var roles = userBranch.Roles.ToList();
return roles;
}
/// <summary>
/// 用于角色管理:分支和角色互动
/// </summary>
/// <param name="branchId"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[Route("paged-roles/{branchId}")]
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetPagedRolesAsync(Guid branchId, PagedAndSortedResultRequestDto input)
{
var listRoles = new List<IdentityRole>();
var getRoleIds = GetUserRolesAsync(branchId);
if (getRoleIds == null)
{
throw new BusinessException("未找到分支和角色的关联信息!");
}
else
{
var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount);
foreach (var roleid in getRoleIds)
{
var filterRole = list.FirstOrDefault(_ => _.Id == roleid.RoleId);
listRoles.Add(filterRole);
}
}
var totalCount = listRoles.Count;
return new PagedResultDto<IdentityRoleDto>(
totalCount,
ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(listRoles)
);
}
protected virtual List<UserBranchRole> GetUserRolesAsync(Guid branchId)
{
var dtos = new List<UserBranchRole>();
var isInRole = _repositoryBranchRole.Where(_ => _.BranchId == branchId);
if (isInRole != null)
{
foreach (var userRoles in isInRole)
{
foreach (var role in userRoles.Roles)
{
dtos.Add(new UserBranchRole() { RoleId = role.RoleId });
}
}
}
return dtos;
}
}
}

413
Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs

@ -0,0 +1,413 @@
using BaseService.BaseData;
using BaseService.Permissions;
using BaseService.RelationBaseData;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BaseService.BaseData.Permissions.Dto;
using BaseService.RelationData.Dto;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Users;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace BaseService.Systems.UserManagement
{
[Route("api/base/user")]
[Authorize(IdentityPermissions.Users.Default)]
public class UserAppService : ApplicationService, IUserAppService
{
protected IdentityUserManager UserManager { get; }
protected IIdentityUserRepository UserRepository { get; }
public IIdentityRoleRepository RoleRepository { get; }
private readonly IRepository<Branch, Guid> _branchRepository;
private readonly IRepository<BranchRole> _branchRoleRepository;
//权限提供者类
private readonly IAbpAuthorizationPolicyProvider _abpAuthorizationPolicyProvider;
private readonly IAuthorizationService _authorizationService;
protected ICurrentUser CurrentUsers { get; }
/// <summary>
/// 权限列表
/// </summary>
protected IPermissionGrantRepository PermissionGrantRepository { get; }
public UserAppService(
IdentityUserManager userManager,
IIdentityUserRepository userRepository,
IIdentityRoleRepository roleRepository,
IRepository<Branch, Guid> branchRepository,
IRepository<BranchRole> branchRoleRepository,
IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider,
IAuthorizationService authorizationService,
ICurrentUser currentUser,
IPermissionGrantRepository permissionGrantRepository)
{
UserManager = userManager;
UserRepository = userRepository;
RoleRepository = roleRepository;
_branchRepository = branchRepository;
_abpAuthorizationPolicyProvider = abpAuthorizationPolicyProvider;
_authorizationService = authorizationService;
CurrentUsers = currentUser;
PermissionGrantRepository = permissionGrantRepository;
_branchRoleRepository = branchRoleRepository;
}
[HttpGet]
[Route("{id}")]
public async Task<IdentityUserDto> GetAsync(Guid id)
{
var dto = ObjectMapper.Map<IdentityUser, IdentityUserDto>(await UserManager.GetByIdAsync(id));
return dto;
}
/// <summary>
/// 获取当前登录用户信息
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("current")]
[AllowAnonymous]
public async Task<IdentityUserDto> GetCurrentUserAsync()
{
var id = CurrentUser.GetId();
var currentUser = await UserManager.GetByIdAsync(id);
var dto = ObjectMapper.Map<IdentityUser, IdentityUserDto>(currentUser);
return dto;
}
[HttpPost]
[Authorize(IdentityPermissions.Users.Create)]
public async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
var user = new IdentityUser(
GuidGenerator.Create(),
input.UserName,
input.Email,
CurrentTenant.Id
);
input.MapExtraPropertiesTo(user);
(await UserManager.CreateAsync(user, input.Password)).CheckErrors();
await UpdateAsync(user, input);
var dto = ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
await CurrentUnitOfWork.SaveChangesAsync();
return dto;
}
[HttpPut]
[Route("{id}")]
[Authorize(IdentityPermissions.Users.Update)]
public async Task<IdentityUserDto> UpdateAsync(Guid id, IdentityUserUpdateDto input)
{
var user = await UserManager.GetByIdAsync(id);
user.ConcurrencyStamp = input.ConcurrencyStamp;
(await UserManager.SetUserNameAsync(user, input.UserName)).CheckErrors();
await UpdateAsync(user, input);
input.MapExtraPropertiesTo(user);
(await UserManager.UpdateAsync(user)).CheckErrors();
if (!input.Password.IsNullOrEmpty())
{
(await UserManager.RemovePasswordAsync(user)).CheckErrors();
(await UserManager.AddPasswordAsync(user, input.Password)).CheckErrors();
}
var dto = ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
await CurrentUnitOfWork.SaveChangesAsync();
return dto;
}
[HttpGet]
public async Task<PagedResultDto<IdentityUserDto>> GetAll(GetIdentityUsersInput input)
{
var totalCount = await UserRepository.GetCountAsync(input.Filter);
var items = await UserRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount,
input.Filter);
var dtos = ObjectMapper.Map<List<IdentityUser>, List<IdentityUserDto>>(items);
return new PagedResultDto<IdentityUserDto>(totalCount, dtos);
}
[HttpGet]
[Route("update")]
protected virtual async Task UpdateAsync(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input)
{
if (!string.Equals(user.Email, input.Email, StringComparison.InvariantCultureIgnoreCase))
{
(await UserManager.SetEmailAsync(user, input.Email)).CheckErrors();
}
if (!string.Equals(user.PhoneNumber, input.PhoneNumber, StringComparison.InvariantCultureIgnoreCase))
{
(await UserManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors();
}
//说明:从3.1升级到3.3后,去掉了TwoFactorEnabled属性
//(await UserManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled)).CheckErrors();
(await UserManager.SetLockoutEnabledAsync(user, input.LockoutEnabled)).CheckErrors();
user.Name = input.Name;
user.Surname = input.Surname;
if (input.RoleNames != null)
{
(await UserManager.SetRolesAsync(user, input.RoleNames)).CheckErrors();
}
}
/// <summary>
/// 获取当前登录用户的分支信息,绑定分支下拉列表项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("current/branches")]
[AllowAnonymous]
public async Task<List<BranchRoleDto>> GetCurrentUserBranchesAsync()
{
var branchList = new List<BranchRoleDto>();
//获取用户的所有分支
var branchRoles = await GetUserBranchRolesAsync(CurrentUsers.GetId());
var groupBranchRoles = branchRoles.GroupBy(x => x.BranchId)
.Select(y => new {xx = new {BranchId = y.Key}, items = y});
foreach (var group in groupBranchRoles
)
{
var mybranchrole = new BranchRoleDto
{
BranchId = @group.xx.BranchId,
BranchName = (await _branchRepository.GetListAsync())
.FirstOrDefault(_ => _.Id == @group.xx.BranchId)?.Name
};
branchList.Add(mybranchrole);
}
return branchList;
}
/// <summary>
/// 根据用户ID,查所有该用户的分支(供用户管理用)
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet]
[Route("{userId}/branches")]
public async Task<ListResultDto<BranchRoleDto>> GetUserBranchesAsync(Guid userId)
{
var branchList = new List<BranchRoleDto>();
//获取用户的所有分支
var branchRoles = await GetUserBranchRolesAsync(userId);
var groupBranchRoles = branchRoles.GroupBy(x => x.BranchId)
.Select(y => new {xx = new {BranchId = y.Key}, items = y});
foreach (var group in groupBranchRoles)
{
var mybranchrole = new BranchRoleDto
{
BranchId = @group.xx.BranchId,
BranchName = (await _branchRepository.GetListAsync())
.FirstOrDefault(_ => _.Id == @group.xx.BranchId)
.Name
};
branchList.Add(mybranchrole);
}
return new ListResultDto<BranchRoleDto>(branchList);
}
/// <summary>
/// 根据用户ID,获取当前登录用户的所有权限信息,带角色名称
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("{userId}/granted-permissions")]
protected virtual async Task<List<PermissionGrant>> GetUserGrantedPermissionsAsync(Guid userId)
{
// var userRoleNames = (await AppService.GetRolesAsync(id)).Items.Select(r => r.Name).ToList();
var listPermiss = new List<PermissionGrant>();
var listRolesName = await UserRepository.GetRoleNamesAsync(userId);
if (listRolesName != null)
{
foreach (var rolename in listRolesName)
{
var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync(RolePermissionValueProvider.ProviderName, rolename);
if (permissionGrantsInRole != null)
{
foreach (var permiss in permissionGrantsInRole)
{
listPermiss.Add(permiss);
}
}
}
}
return listPermiss;
}
/// <summary>
/// 获取当前用户的组织信息
/// </summary>
/// <param name="uid"></param>
/// <returns></returns>
protected virtual async Task<List<BranchRoleDto>> GetUserBranchRolesAsync(Guid userId)
{
var branchList = new List<BranchRole>();
//获取当前用户的所有角色
var userRoles = await UserRepository.GetRolesAsync(userId);
if (userRoles == null)
{
throw new BusinessException("当前登录用户没有任何角色信息,请找管理员进行维护!");
}
else
{
//获取所有分支-角色的信息
var allBranchRoles = await _branchRoleRepository.GetListAsync();
if (allBranchRoles != null)
{
foreach (var role in userRoles)
{
var branchRoles = allBranchRoles.Where(_ => _.RoleId == role.Id).ToList();
foreach (var branch in branchRoles)
{
if (branch == null)
continue; //该用户没有角色-分支信息
var branchRole = new BranchRole(branch.BranchId, role.Id);
branchList.Add(branchRole);
}
}
}
else
{
// Logger.LogDebug("未找到分支和角色的关联信息!");
throw new BusinessException("未找到分支和角色的关联信息!");
}
}
var dtos = ObjectMapper.Map<List<BranchRole>, List<BranchRoleDto>>(branchList);
return new List<BranchRoleDto>(dtos);
}
/// <summary>
/// 重要:根据分支ID,过滤当前登录用户的权限信息
/// </summary>
/// <param name="branchId"></param>
/// <returns></returns>
[HttpGet]
[Route("{branchId}/auth-config")]
public async Task<ApplicationAuthes> GetAuthConfigAsync(Guid branchId)
{
var authConfig = new ApplicationAuthes();
var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync();
foreach (var policyName in policyNames)
{
authConfig.Policies[policyName] = true;
//if (await _authorizationService.IsGrantedAsync(policyName))
//{
// authConfig.GrantedPolicies[policyName] = true;
//}
}
var userPermissList = new List<BranchPermissionDto>();
var userId = CurrentUsers.GetId();
//获取当前用户的所有权限信息
var getUserPermissions = await GetUserGrantedPermissionsAsync(userId);
//获取当前用户的所有分支
var gerUserBranches = await GetUserBranchRolesAsync(userId);
if (gerUserBranches == null)
{
throw new BusinessException("当前登录用户没有任何分支信息,请找管理员进行维护!");
}
else
{
//根据分支ID过滤
var branchRoles = gerUserBranches.Where(_ => _.BranchId == branchId).ToList();
if (!branchRoles.Any())
{
throw new BusinessException("当前登录用户在分支【" + branchRoles.FirstOrDefault()?.BranchName + "】中不存在!");
}
else
{
if (getUserPermissions == null)
{
throw new BusinessException("当前登录用户没有任何权限信息,请找管理员进行维护!");
}
else
{
foreach (var role in branchRoles)
{
var userPermission = getUserPermissions.Where(_ => _.ProviderKey == role.RoleName);
foreach (var permission in userPermission)
{
authConfig.GrantedPolicies.Add(permission.Name, true);
}
}
}
}
}
return authConfig;
}
/// <summary>
/// 重置密码功能
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
//[HttpPut]
//[Route("{userId}/reset-password")]
//public async Task<IdentityUserDto> ResetPasswordAsync(Guid userId)
//{
// var user = await UserManager.FindByIdAsync(userId.ToString());
// string token = await UserManager.GeneratePasswordResetTokenAsync(user);
// await UserManager.ResetPasswordAsync(user, token, "1q2w3E*");
// //await UserManager.ResetPasswordAsync(user, token, "123456");
// var dto = ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
// return dto;
//}
[HttpPut]
[Route("{userId}/reset-password")]
[Authorize(IdentityPermissions.Users.Update)]
public async Task<IdentityUserDto> ResetPasswordAsync(Guid userId)
{
var user = await UserManager.FindByIdAsync(userId.ToString());
//string token = await UserManager.GeneratePasswordResetTokenAsync(user);//err:No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.
//await UserManager.ResetPasswordAsync(user, token, "1q2w3E*");
await UserManager.RemovePasswordAsync(user);
if (user.PasswordHash == null)
{
(await UserManager.AddPasswordAsync(user, "123456")).CheckErrors();
}
var dto = ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
return dto;
}
}
}

503
Modules/BaseService/BaseService.Application/UserManagement/UserBranchAppService.cs

@ -0,0 +1,503 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BaseService.BaseData;
using BaseService.BaseData.BranchManagement;
using BaseService.BaseData.Permissions.Dto;
using BaseService.BaseData.UserBranchRoleManagement;
using BaseService.BaseData.UserBranchRoleManagement.Dto;
using BaseService.Permissions;
using BaseService.RelationData.Dto;
using BaseService.Systems.UserManagement;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Users;
namespace BaseService.UserManagement
{
[Route("api/base/userbranch")]
//[Authorize(BaseServicePermissions.UserBranch.Default)]
public class UserBranchAppService : ApplicationService, IUserBranchAppService
{
/// <summary>
/// 角色
/// </summary>
protected IIdentityRoleRepository IdentityRoleRepository { get; }
private readonly IBranchAppService _branchAppService;
private readonly IUserAppService _userAppService;
private readonly IRepository<UserBranch, Guid> _repository;
//权限提供者类
private readonly IAbpAuthorizationPolicyProvider _abpAuthorizationPolicyProvider;
/// <summary>
/// 当前用户
/// </summary>
protected ICurrentUser CurrentUsers { get; }
protected IIdentityUserRepository UserRepository { get; }
/// <summary>
/// 权限类
/// </summary>
protected IPermissionGrantRepository PermissionGrantRepository { get; }
public UserBranchAppService(
IRepository<UserBranch, Guid> repository,
IIdentityRoleRepository identityRoleRepository,
IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider,
ICurrentUser currentUser,
IIdentityUserRepository userRepository,
IPermissionGrantRepository permissionGrantRepository,
IUserAppService userAppService,
IBranchAppService branchAppService)
{
_repository = repository;
IdentityRoleRepository = identityRoleRepository;
_abpAuthorizationPolicyProvider = abpAuthorizationPolicyProvider;
CurrentUsers = currentUser;
UserRepository = userRepository;
_branchAppService = branchAppService;
_userAppService = userAppService;
PermissionGrantRepository = permissionGrantRepository;
}
/// <summary>
/// 添加
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("createUpdate")]
//[Authorize(BaseServicePermissions.UserBranch.Create)]
public virtual async Task CreateUpdateAsync(CreateOrUpdateUserBranchDto input)
{
var userBranch = await _repository.FirstOrDefaultAsync(_ => _.UserId == input.UserId && _.BranchId == input.BranchId);
if (userBranch == null)
{
//执行添加操作
var createUserBranch = new UserBranch(GuidGenerator.Create(),
input.UserId,
input.BranchId
);
var userBranchRoles = input.Roles;
//选择了角色信息
foreach (var role in userBranchRoles)
{
createUserBranch.AddRole(role.RoleId);
}
await _repository.InsertAsync(createUserBranch);
ObjectMapper.Map<UserBranch, UserBranchDto>(createUserBranch);
}
else
{
userBranch.UserId = input.UserId;
userBranch.BranchId = input.BranchId;
//修改角色信息
var getRoleIds = userBranch.Roles.ToList();
if (getRoleIds != null)
{
for (int i = getRoleIds.Count; i > 0; i--)
{
var role = getRoleIds[i - 1];
userBranch.RemoveRole(role.RoleId);
}
var getRoles = input.Roles;
if (getRoles != null)
{
foreach (var role in getRoles)
{
userBranch.AddRole(role.RoleId);
}
}
}
if (input.Roles == null || input.Roles.Count == 0)
{
await _repository.UpdateAsync(userBranch);
}
else
{
await _repository.UpdateAsync(userBranch, true);
}
ObjectMapper.Map<UserBranch, UserBranchDto>(userBranch);
}
}
//public virtual async Task<UserBranchDto> CreateAsync(CreateOrUpdateUserBranchDto input)
//{
// var exist = await _repository.FirstOrDefaultAsync(_ => _.UserId == input.UserId && _.BranchId == input.BranchId);
// if (exist != null) throw new BusinessException("该资源信息已存在,不要重复添加!");
// var userBranch = new UserBranch(GuidGenerator.Create(),
// input.UserId,
// input.BranchId
// );
// await _repository.InsertAsync(userBranch);
// var userBranchRoles = input.Roles;
// //选择了角色信息
// foreach (var role in userBranchRoles)
// {
// userBranch.AddRole(role.RoleId);
// }
// return ObjectMapper.Map<UserBranch, UserBranchDto>(userBranch);
//}
/// <summary>
/// 单条删除
/// </summary>
/// <param name="userId"></param>
/// <param name="branchId"></param>
/// <returns></returns>
[HttpPost]
[Route("{userId}/{branchId}/delete")]
[Authorize(BaseServicePermissions.UserBranch.Delete)]
public virtual async Task DeleteUnitAsync(Guid userId, Guid branchId)
{
await _repository.DeleteAsync(p => p.UserId == userId && p.BranchId == branchId);
}
/// <summary>
/// 根据用户ID进行删除
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpPost]
[Route("{userId}/delete")]
[Authorize(BaseServicePermissions.UserBranch.Delete)]
public virtual async Task DeleteUnitAsync(Guid userId)
{
await _repository.DeleteAsync(p => p.UserId == userId);
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpPost]
[Route("delete")]
[Authorize(BaseServicePermissions.UserBranch.Delete)]
public virtual async Task DeleteAsync(List<Guid> ids)
{
foreach (var id in ids)
{
await _repository.DeleteAsync(_ => _.Id == id);
}
}
/// <summary>
/// 修改操作
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut]
[Route("{id}")]
[Authorize(BaseServicePermissions.UserBranch.Update)]
public virtual async Task<UserBranchDto> UpdateAsync(Guid id, CreateOrUpdateUserBranchDto input)
{
var userBranch = await _repository.FirstOrDefaultAsync(_ => _.UserId == input.UserId && _.BranchId == input.BranchId);
userBranch.UserId = input.UserId;
userBranch.BranchId = input.BranchId;
//修改角色信息
var getRoleIds = userBranch.Roles;
if (getRoleIds != null)
{
foreach (var removerole in getRoleIds)
{
userBranch.RemoveRole(removerole.RoleId);
}
var getRoles = input.Roles;
if (getRoles != null)
{
foreach (var role in getRoles)
{
userBranch.AddRole(role.RoleId);
}
}
}
return ObjectMapper.Map<UserBranch, UserBranchDto>(userBranch);
}
/// <summary>
/// 查单条数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("{id}")]
public virtual async Task<UserBranchDto> GetAsync(Guid id)
{
var result = await _repository.GetAsync(id);
return ObjectMapper.Map<UserBranch, UserBranchDto>(result);
}
/// <summary>
/// 分页查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[Route("paged")]
public virtual async Task<PagedResultDto<UserBranchDto>> GetPagedListAsync(GetUserBranchInput input)
{
var query = _repository
.WhereIf(input.UserId.HasValue, _ => _.UserId == input.UserId);
var items = await query
.Skip(input.SkipCount)
.Take(input.MaxResultCount)
.ToListAsync();
var totalCount = await query.CountAsync();
var dtos = ObjectMapper.Map<List<UserBranch>, List<UserBranchDto>>(items);
return new PagedResultDto<UserBranchDto>(totalCount, dtos);
}
/// <summary>
/// 分支列表(输入用户ID)
/// </summary>
/// <param name="userId">用户ID</param>
/// <returns></returns>
[HttpGet]
[Route("{userId}/branches")]
[AllowAnonymous]
public virtual async Task<List<UserBranchDto>> GetUserBranchsAsync(Guid userId)
{
var dtos = new List<UserBranchDto>();
await GetBranchList(userId, dtos);
return dtos;
}
private async Task GetBranchList(Guid userId, List<UserBranchDto> dtos)
{
var userBranches = _repository.Where(_ => _.UserId == userId);
foreach (var query in userBranches)
{
var branch = await _branchAppService.GetAsync(query.BranchId);
dtos.Add(new UserBranchDto()
{
BranchId = query.BranchId,
BranchName = branch.Name,
});
}
}
/// <summary>
/// 分支列表(当前登录用户)
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("current/branches")]
[AllowAnonymous]
public virtual async Task<List<UserBranchDto>> GetCurrentUserBranchesAsync()
{
var dtos = new List<UserBranchDto>();
await GetBranchList(CurrentUser.GetId(), dtos);
return dtos;
}
/// <summary>
/// 获取当前登录用户默认的组织
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("user-branch/{userId}")]
[AllowAnonymous]
public virtual async Task<UserBranchDto> GetCurrentUserBranchAsync(Guid userId)
{
var dto = new UserBranchDto();
var userBranche = _repository.FirstOrDefault(_ => _.UserId == userId);
if (userBranche == null)
{
throw new BusinessException("当前登录用户不存在!");
}
var branch = await _branchAppService.GetAsync(userBranche.BranchId);
dto.BranchId = branch.Id;
return dto;
}
/// <summary>
/// 获取当前登录用户所在组织的所有权限信息
/// </summary>
/// <param name="branchId"></param>
/// <returns></returns>
[HttpGet]
[Route("{branchId}/auth-config")]
[AllowAnonymous]
public virtual async Task<ApplicationAuthes> GetAuthConfigAsync(Guid branchId)
{
var authConfig = new ApplicationAuthes();
var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync();
foreach (var policyName in policyNames)
{
authConfig.Policies[policyName] = true;
}
var userId = CurrentUser.GetId();
//获取当前用户的所有权限信息
var grantedPermuissions = await GetUserGrantedPermissionsAsync(userId, branchId);
if (grantedPermuissions == null || grantedPermuissions.Count == 0)
{
throw new BusinessException("当前登录用户没有任何权限信息,请找管理员进行维护!");
}
//获取当前用户所在组织的所有角色名
var userRoleName = await GetUserRoleNamesAsync(userId, branchId);
if (userRoleName == null)
{
throw new BusinessException("当前登录用户没有任何组织信息,请找管理员进行维护!");
}
foreach (var roleName in userRoleName)
{
var userPermission = grantedPermuissions.Where(_ => _.ProviderKey == roleName);
foreach (var permission in userPermission)
{
//GrantedPolicies的key键不能相同
if (authConfig.GrantedPolicies.ContainsKey(permission.Name))
continue;
authConfig.GrantedPolicies.Add(permission.Name, true);
}
}
return authConfig;
}
/// <summary>
/// 权限信息(单个用户)(获取权限调用)
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
protected virtual async Task<List<PermissionGrant>> GetUserGrantedPermissionsAsync(Guid userId,Guid branchId)
{
var permissionGrants = new List<PermissionGrant>();
var listRolesName = await GetUserRoleNamesAsync(userId, branchId);
if (listRolesName != null)
{
foreach (var rolename in listRolesName)
{
var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync(RolePermissionValueProvider.ProviderName, rolename);
if (permissionGrantsInRole != null)
{
foreach (var permiss in permissionGrantsInRole)
{
permissionGrants.Add(permiss);
}
}
}
}
return permissionGrants;
}
/// <summary>
/// 获取出用户所在当前组织的所有角色名称(获取权限调用)
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
protected virtual async Task<List<string>> GetUserRoleNamesAsync(Guid userId, Guid branchId)
{
var userBranch = await _repository.GetAsync(_ => _.UserId == userId && _.BranchId == branchId);
var userRoles = userBranch.Roles.ToList();
//var userRoles = await GetUserRolesAsync(userId, branchId);
var roles = await IdentityRoleRepository.GetListAsync();
return userRoles.Select(role => roles.FirstOrDefault(p => p.Id == role.RoleId)?.Name)
.Where(roleName => !string.IsNullOrWhiteSpace(roleName)).ToList();
}
/// <summary>
/// 根据用户ID、组织ID获取该用户角色信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet]
[Route("userRoles/{userId}/{branchId}")]
public virtual async Task<List<UserBranchRole>> GetUserRolesAsync(Guid userId,Guid branchId)
{
var roleList = new List<UserBranchRole>();
var isInRole = _repository.FirstOrDefault(_ => _.UserId == userId && _.BranchId == branchId);
if (isInRole != null)
{
var userBranch = await _repository.GetAsync(_ => _.UserId == userId && _.BranchId == branchId);
var roles = userBranch.Roles.ToList();
foreach(var role in roles)
{
roleList.Add(new UserBranchRole() { RoleId = role.RoleId });
}
}
return roleList;
}
/// <summary>
/// 根据组织ID查角色信息
/// </summary>
/// <param name="branchId"></param>
/// <returns></returns>
[HttpGet]
[Route("userRoles/{branchId}")]
public virtual List<UserBranchRole> GetBranchRolesAsync(Guid branchId)
{
var dtos = new List<UserBranchRole>();
var isInRole = _repository.Where(_ => _.BranchId == branchId);
if (isInRole != null)
{
foreach (var userRoles in isInRole)
{
foreach (var role in userRoles.Roles)
{
dtos.Add(new UserBranchRole() { RoleId = role.RoleId });
}
}
}
return dtos;
//var roleList = new List<UserBranchRole>();
//var isInRole = _repository.Where(_ => _.BranchId == branchId);
//if(isInRole!=null)
//{
// var userBranch = await _repository.GetAsync(_ => _.BranchId == branchId);
// var roles = userBranch.Roles.ToList();
// foreach (var role in roles)
// {
// roleList.Add(new UserBranchRole() { RoleId = role.RoleId });
// }
//}
//return roleList;
}
/// <summary>
/// 根据用户ID查角色信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
[HttpGet]
[Route("{userId}/userRoles")]
public virtual List<UserBranchRole> GetUserRolesAsync(Guid userId)
{
var dtos = new List<UserBranchRole>();
var isInRole = _repository.Where(_ => _.UserId == userId);
if (isInRole != null)
{
foreach (var userRoles in isInRole)
{
foreach (var role in userRoles.Roles)
{
dtos.Add(new UserBranchRole() { RoleId = role.RoleId });
}
}
}
return dtos;
}
}
}

14
Modules/BaseService/BaseService.Domain/BaseData/AppIdentityRole.cs

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Identity;
namespace BaseService.BaseData
{
public class AppIdentityRole: IdentityRole
{
public string RoleName { get; set; }
public Guid RoleId { get; set; }
}
}

152
Modules/BaseService/BaseService.Domain/BaseData/Branch.cs

@ -0,0 +1,152 @@
using BaseService.RelationBaseData;
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace BaseService.BaseData
{
public class Branch : AuditedAggregateRoot<Guid>, ISoftDelete
{
public Guid? TenantId { get; set; }
/// <summary>
/// 机构分类:1.公司;2.组织;3.部门;4.供应商
/// </summary>
public short CategoryId { get; set; }
public Guid? Pid { get; set; }
public string Name { get; set; }
public string FullName { get; set; }
public int Sort { get; set; }
/// <summary>
/// 是否子集
/// </summary>
public bool Leaf { get; set; }
/// <summary>
/// 级联
/// </summary>
public string CascadeId { get; set; }
public bool Enabled { get; set; }
public bool IsDeleted { get; set; }
public virtual ICollection<BranchRole> Roles { get; set; }
public Branch(Guid id, Guid? tenantId, short categoryId, Guid? pid, [NotNull] string name, string fullName, int sort, bool leaf, bool enabled)
{
TenantId = tenantId;
Id = id;
CategoryId = categoryId;
Pid = pid;
Name = name;
FullName = fullName;
Sort = sort;
Enabled = enabled;
Leaf = leaf;
Roles = new Collection<BranchRole>();
}
public virtual void AddRole(Guid roleId)
{
Check.NotNull(roleId, nameof(roleId));
if (IsInRole(roleId))
{
return;
}
Roles.Add(new BranchRole(roleId, Id));
}
public virtual void RemoveRole(Guid roleId)
{
Check.NotNull(roleId, nameof(roleId));
if (!IsInRole(roleId))
{
return;
}
Roles.RemoveAll(r => r.RoleId == roleId);
}
public virtual bool IsInRole(Guid roleId)
{
Check.NotNull(roleId, nameof(roleId));
return Roles.Any(r => r.RoleId == roleId);
}
///// <summary>
///// 机构分类:1.公司;2.分支;3.部门;4.供应商
///// </summary>
//public short CategoryId { get; set; }
//public Guid? Pid { get; set; }
//public string Name { get; set; }
//public string FullName { get; set; }
//public int Sort { get; set; }
//public bool Enabled { get; set; }
//public bool IsDeleted { get; set; }
//public virtual ICollection<BranchRole> Roles { get; set; }
//public Branch(Guid id, short categoryId, Guid? pid, [NotNull] string name, string fullName, int sort, bool enabled)
//{
// Id = id;
// CategoryId = categoryId;
// Pid = pid;
// Name = name;
// FullName = fullName;
// Sort = sort;
// Enabled = enabled;
// Roles = new Collection<BranchRole>();
//}
//public virtual void AddRole(Guid roleId)
//{
// Check.NotNull(roleId, nameof(roleId));
// if (IsInRole(roleId))
// {
// return;
// }
// Roles.Add(new BranchRole(roleId, Id));
//}
//public virtual void RemoveRole(Guid roleId)
//{
// Check.NotNull(roleId, nameof(roleId));
// if (!IsInRole(roleId))
// {
// return;
// }
// Roles.RemoveAll(r => r.RoleId == roleId);
//}
//public virtual bool IsInRole(Guid roleId)
//{
// Check.NotNull(roleId, nameof(roleId));
// return Roles.Any(r => r.RoleId == roleId);
//}
}
}

90
Modules/BaseService/BaseService.Domain/BaseData/UserBranch.cs

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace BaseService.BaseData
{
/// <summary>
/// 用户-分支
/// </summary>
public class UserBranch : AuditedAggregateRoot<Guid>
{
/// <summary>
/// 用户ID
/// </summary>
public Guid UserId { get; set; }
// /// <summary>
// /// 用户名称
// /// </summary>
// [NotMapped]
// public string UserName { get; set; }
/// <summary>
/// 分支ID
/// </summary>
public Guid BranchId { get; set; }
// /// <summary>
// /// 分支机构名称
// /// </summary>
// [NotMapped]
// public string BranchName { get; set; }
//
/// <summary>
/// 软删除
/// </summary>
//public bool IsDeleted { get; set; }
public virtual ICollection<UserBranchRole> Roles { get; set; }
public UserBranch(Guid id, Guid userId, Guid branchId) : base(id)
{
UserId = userId;
BranchId = branchId;
Roles = new Collection<UserBranchRole>();
}
public virtual void AddRole(Guid roleId)
{
Check.NotNull(roleId, nameof(roleId));
if (IsInRole(roleId))
{
return;
}
Roles.Add(new UserBranchRole(roleId));
}
public virtual void RemoveRole(Guid roleId)
{
Check.NotNull(roleId, nameof(roleId));
if (!IsInRole(roleId))
{
return;
}
Roles.RemoveAll(r => r.RoleId == roleId);
}
public virtual bool IsInRole(Guid roleId)
{
Check.NotNull(roleId, nameof(roleId));
return Roles.Any(r => r.RoleId == roleId);
}
}
}

41
Modules/BaseService/BaseService.Domain/BaseData/UserBranchRole.cs

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Values;
using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
namespace BaseService.BaseData
{
/// <summary>
/// 用户--分支--角色(多对多表)
/// </summary>
public class UserBranchRole : ValueObject
{
/// <summary>
/// 角色ID
/// </summary>
public Guid RoleId { get; set; }
public UserBranchRole()
{
}
public UserBranchRole(Guid roleId)
{
RoleId = roleId;
}
protected override IEnumerable<object> GetAtomicValues()
{
yield return RoleId;
}
}
}

35
Modules/BaseService/BaseService.Domain/BaseService.Domain.csproj

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>BaseService</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="BaseData\AppIdentityRole.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="Localization\BaseService\cs.json" />
<None Remove="Localization\BaseService\en.json" />
<None Remove="Localization\BaseService\zh-Hans.json" />
<None Remove="Localization\BaseService\zh-Hant.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\BaseService\cs.json" />
<EmbeddedResource Include="Localization\BaseService\en.json" />
<EmbeddedResource Include="Localization\BaseService\zh-Hans.json" />
<EmbeddedResource Include="Localization\BaseService\zh-Hant.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="4.3.3" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Users.Domain" Version="4.3.3" />
</ItemGroup>
</Project>

15
Modules/BaseService/BaseService.Domain/BaseServiceConsts.cs

@ -0,0 +1,15 @@
namespace BaseService
{
public static class BaseServiceConsts
{
public const int MaxNumeralLength = 16;
public const int MaxCodeLength = 32;
public const int MaxNameLength = 50;
public const int MaxFullNameLength = 128;
public const int MaxNotesLength = 256;
}
}

41
Modules/BaseService/BaseService.Domain/BaseServiceDomainModule.cs

@ -0,0 +1,41 @@
using BaseService.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
namespace BaseService
{
[DependsOn(
typeof(AbpPermissionManagementDomainIdentityModule)
)]
public class BaseServiceDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureVirtualFileSystem();
ConfigureLocalization();
}
private void ConfigureLocalization()
{
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<BaseServiceResource>("zh-Hans")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/BaseService");
});
}
private void ConfigureVirtualFileSystem()
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<BaseServiceDomainModule>("BaseService");
});
}
}
}

32
Modules/BaseService/BaseService.Domain/BaseServiceModuleExtensionConfigurator.cs

@ -0,0 +1,32 @@
using Volo.Abp.Threading;
namespace BaseService
{
public class BaseServiceModuleExtensionConfigurator
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
ConfigureExistingProperties();
});
}
private static void ConfigureExistingProperties()
{
/* You can change max lengths for properties of the
* entities defined in the modules used by your application.
*
* Example: Change user and role name max lengths
IdentityUserConsts.MaxNameLength = 99;
IdentityRoleConsts.MaxNameLength = 99;
* Notice: It is not suggested to change property lengths
* unless you really need it. Go with the standard values wherever possible.
*/
}
}
}

13
Modules/BaseService/BaseService.Domain/Localization/BaseService/cs.json

@ -0,0 +1,13 @@
{
"culture": "cs",
"texts": {
"Menu:Home": "Úvod",
"Welcome": "Vítejte",
"LongWelcomeMessage": "Vítejte v aplikaci. Toto je startovací projekt založený na ABP frameworku. Pro více informací, navštivte abp.io.",
"Edit": "修改",
"Delete": "删除",
"Create": "新增",
"Business": "业务",
"DataDictionary": "数据字典"
}
}

8
Modules/BaseService/BaseService.Domain/Localization/BaseService/en.json

@ -0,0 +1,8 @@
{
"culture": "en",
"texts": {
"Menu:Home": "Home",
"Welcome": "Welcome",
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io."
}
}

8
Modules/BaseService/BaseService.Domain/Localization/BaseService/pl.json

@ -0,0 +1,8 @@
{
"culture": "pl",
"texts": {
"Menu:Home": "Home",
"Welcome": "Witaj",
"LongWelcomeMessage": "Witaj w aplikacji. To jest inicjalny projekt bazujący na ABP framework. Po więcej informacji odwiedź stronę abp.io."
}
}

8
Modules/BaseService/BaseService.Domain/Localization/BaseService/pt-BR.json

@ -0,0 +1,8 @@
{
"culture": "pt-BR",
"texts": {
"Menu:Home": "Principal",
"Welcome": "Seja bem-vindo!",
"LongWelcomeMessage": "Bem-vindo a esta aplicação. Este é um projeto inicial baseado no ABP framework. Para mais informações, visite abp.io."
}
}

8
Modules/BaseService/BaseService.Domain/Localization/BaseService/tr.json

@ -0,0 +1,8 @@
{
"culture": "tr",
"texts": {
"Menu:Home": "Ana sayfa",
"Welcome": "Hoşgeldiniz",
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz."
}
}

8
Modules/BaseService/BaseService.Domain/Localization/BaseService/vi.json

@ -0,0 +1,8 @@
{
"culture": "vi",
"texts": {
"Menu:Home": "Trang chủ",
"Welcome": "Chào mừng bạn",
"LongWelcomeMessage": "Chào mừng bạn đến ứng dụng. Đây là một dự án khởi nghiệp dựa trên khung ABP. Để biết thêm thông tin, hãy truy cập abp.io."
}
}

18
Modules/BaseService/BaseService.Domain/Localization/BaseService/zh-Hans.json

@ -0,0 +1,18 @@
{
"culture": "zh-Hans",
"texts": {
"Menu:Home": "首页",
"Welcome": "欢迎",
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io.",
"Edit": "修改",
"Delete": "删除",
"Create": "新增",
"BaseService": "基础服务",
"DataDictionary": "数据字典",
"Branch": "分支机构",
"Job": "岗位",
"Employee": "职员",
"AbpSettingManagement": "设置管理",
"AuditLogging": "系统日志"
}
}

8
Modules/BaseService/BaseService.Domain/Localization/BaseService/zh-Hant.json

@ -0,0 +1,8 @@
{
"culture": "zh-Hant",
"texts": {
"Menu:Home": "首頁",
"Welcome": "歡迎",
"LongWelcomeMessage": "歡迎來到此應用程式. 這是一個基於ABP框架的起始專案. 有關更多訊息, 請瀏覽 abp.io."
}
}

9
Modules/BaseService/BaseService.Domain/Localization/BaseServiceResource.cs

@ -0,0 +1,9 @@
using Volo.Abp.Localization;
namespace BaseService.Localization
{
[LocalizationResourceName("BaseService")]
public class BaseServiceResource
{
}
}

48
Modules/BaseService/BaseService.Domain/RelationBaseData/BranchRole.cs

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace BaseService.RelationBaseData
{
public class BranchRole : CreationAuditedEntity
{
/// <summary>
/// Id of the Role.
/// </summary>
public Guid RoleId { get; set; }
/// <summary>
/// Id of the Branch />.
/// </summary>
public Guid BranchId { get; set; }
/// <summary>
/// Initializes a new instance of the BranchRole/> class.
/// </summary>
protected BranchRole()
{
}
/// <summary>
/// Initializes a new instance of the BranchRole/> class.
/// </summary>
/// <param name="roleId">Id of the Role.</param>
/// <param name="branchId">Id of the Branch/>.</param>
public BranchRole(Guid roleId, Guid branchId)
{
RoleId = roleId;
BranchId = branchId;
}
public override object[] GetKeys()
{
return new object[] { BranchId, RoleId };
}
}
}

45
Modules/BaseService/BaseService.Domain/Users/AppUser.cs

@ -0,0 +1,45 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Users;
namespace BaseService.Users
{
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser
{
#region Base properties
/* These properties are shared with the IdentityUser entity of the Identity module.
* Do not change these properties through this class. Instead, use Identity module
* services (like IdentityUserManager) to change them.
* So, this properties are designed as read only!
*/
public virtual Guid? TenantId { get; private set; }
public virtual string UserName { get; private set; }
public virtual string Name { get; private set; }
public virtual string Surname { get; private set; }
public virtual string Email { get; private set; }
public virtual bool EmailConfirmed { get; private set; }
public virtual string PhoneNumber { get; private set; }
public virtual bool PhoneNumberConfirmed { get; private set; }
#endregion
//public Guid BranchId { get; set; }
//public bool Enable { get; set; }
private AppUser()
{
}
}
}

21
Modules/BaseService/BaseService.EntityFrameworkCore/BaseService.EntityFrameworkCore.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>BaseService</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseService.Domain\BaseService.Domain.csproj" />
</ItemGroup>
</Project>

55
Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseDbContextModelCreatingExtensions.cs

@ -0,0 +1,55 @@

using BaseService.BaseData;
using BaseService.RelationBaseData;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace BaseService.EntityFrameworkCore
{
public static class BaseDbContextModelCreatingExtensions
{
public static void ConfigureBaseService(this ModelBuilder builder)
{
Check.NotNull(builder, nameof(builder));
builder.Entity<Branch>(b =>
{
b.ToTable("base_branches");
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(BaseServiceConsts.MaxNameLength);
b.Property(x => x.FullName).IsRequired().HasMaxLength(BaseServiceConsts.MaxFullNameLength);
b.Property(x => x.Enabled).HasDefaultValue(false);
b.HasIndex(q => q.Pid);
});
builder.Entity<UserBranch>(b =>
{
b.ToTable("base_user_branches");
b.ConfigureByConvention();
b.OwnsMany(p => p.Roles).ToTable("base_user_branch_role");
});
//分支-角色
builder.Entity<BranchRole>(b =>
{
b.ToTable("base_branch_role");
b.ConfigureByConvention();
b.HasKey(ou => new { ou.BranchId, ou.RoleId });
//b.HasOne<Volo.Abp.Identity.IdentityRole>().WithMany().HasForeignKey(ou => ou.RoleId).IsRequired();
});
}
}
}

28
Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseEfCoreEntityExtensionMappings.cs

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore;
using System;
using Volo.Abp.Identity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Threading;
namespace BaseService.EntityFrameworkCore
{
public class BaseEfCoreEntityExtensionMappings
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
BaseServiceModuleExtensionConfigurator.Configure();
//OneTimeRunner.Run(() =>
//{
// ObjectExtensionManager.Instance
// .MapEfCoreProperty<IdentityUser, bool>(
// "Enable",
// b => { b.HasDefaultValue(false); }
// )
// .MapEfCoreProperty<IdentityUser, Guid>("BranchId");
//});
}
}
}

61
Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseServiceDbContext.cs

@ -0,0 +1,61 @@

using BaseService.BaseData;
using BaseService.RelationBaseData;
using BaseService.Users;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.Identity;
using Volo.Abp.Users.EntityFrameworkCore;
namespace BaseService.EntityFrameworkCore
{
[ConnectionStringName("Default")]
public class BaseServiceDbContext : AbpDbContext<BaseServiceDbContext>
{
public DbSet<Branch> Branches { get; set; }
/// <summary>
/// 用户-分支-角色
/// </summary>
public DbSet<UserBranchRole> UserBranchRoles { get; set; }
/// <summary>
/// 用户-分支
/// </summary>
public DbSet<UserBranch> UserBranchs { get; set; }
/// <summary>
/// 分支--角色
/// </summary>
public DbSet<BranchRole> BranchRoles { get; set; }
public BaseServiceDbContext(DbContextOptions<BaseServiceDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
//builder.Entity<AppUser>(b =>
//{
// b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users"); //Sharing the same table "AbpUsers" with the IdentityUser
// b.ConfigureByConvention();
// b.ConfigureAbpUser();
// b.Property(x => x.Enable).HasDefaultValue(true);
//});
builder.ConfigureBaseService();
}
}
}

45
Modules/BaseService/BaseService.EntityFrameworkCore/EntityFrameworkCore/BaseServiceEntityFrameworkCoreModule.cs

@ -0,0 +1,45 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
namespace BaseService.EntityFrameworkCore
{
[DependsOn(
typeof(BaseServiceDomainModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpIdentityEntityFrameworkCoreModule)
)]
public class BaseServiceEntityFrameworkCoreModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
BaseEfCoreEntityExtensionMappings.Configure();
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureDbContext();
ConfigureRepository(context);
}
private static void ConfigureRepository(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<BaseServiceDbContext>(options =>
{
options.AddDefaultRepositories(includeAllEntities: true);
});
}
private void ConfigureDbContext()
{
Configure<AbpDbContextOptions>(options => { options.UseSqlServer(); });
}
}
}

60
Modules/BaseService/BaseService.Host/BaseService.Host.csproj

@ -0,0 +1,60 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>BaseService</RootNamespace>
<UserSecretsId>5a8c596c-d1b1-44b5-8758-988198ece459</UserSecretsId>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>D:\2020工作文件\WMS2.0\WMS2.0合并\SmartFactorySuite\src\Modules\BaseService\BaseService.Host\BaseService.Host.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<Content Remove="Logs\**" />
<EmbeddedResource Remove="Logs\**" />
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup>
<!-- <PackageReference Include="BaseData.Application.Contracts" Version="3.2.3" /> -->
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<!-- <PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" /> -->
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="SettleAccount.HttpApi" Version="1.0.21" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="4.3.3" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="4.3.3" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Autofac" Version="4.3.3" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="4.3.3" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.TenantManagement.HttpApi" Version="4.3.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseService.Application\BaseService.Application.csproj" />
<ProjectReference Include="..\BaseService.EntityFrameworkCore\BaseService.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\BaseService.HttpApi\BaseService.HttpApi.csproj" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" properties_4launchsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>

14
Modules/BaseService/BaseService.Host/BaseService.Host.xml

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>BaseService.Host</name>
</assembly>
<members>
<member name="M:BaseService.BaseServiceHostModule.ConfigurePasswordSet(Volo.Abp.Modularity.ServiceConfigurationContext)">
<summary>
设置密码强度
</summary>
<param name="context"></param>
</member>
</members>
</doc>

275
Modules/BaseService/BaseService.Host/BaseServiceHostModule.cs

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

13
Modules/BaseService/BaseService.Host/Controllers/HomeController.cs

@ -0,0 +1,13 @@
//using Microsoft.AspNetCore.Mvc;
//using Volo.Abp.AspNetCore.Mvc;
//namespace BaseService.Controllers
//{
// public class HomeController : AbpController
// {
// public ActionResult Index()
// {
// return Redirect("/swagger");
// }
// }
//}

37
Modules/BaseService/BaseService.Host/EntityFrameworkCore/BaseServiceMigrationDbContext.cs

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace BaseService.EntityFrameworkCore
{
public class BaseServiceMigrationDbContext : AbpDbContext<BaseServiceMigrationDbContext>
{
public BaseServiceMigrationDbContext(
DbContextOptions<BaseServiceMigrationDbContext> options
) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureTenantManagement();
builder.ConfigureBaseService();
}
}
}

31
Modules/BaseService/BaseService.Host/EntityFrameworkCore/BaseServiceMigrationDbContextFactory.cs

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

1371
Modules/BaseService/BaseService.Host/FileStorage/Migrations/BaseServiceMigrationDbContextModelSnapshot.cs

File diff suppressed because it is too large

100
Modules/BaseService/BaseService.Host/Migrations/20210127044859_127-2.Designer.cs

@ -0,0 +1,100 @@
// <auto-generated />
using System;
using BaseService.EntityFrameworkCore;
//using FileStorage.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
namespace FileStorage.Migrations
{
[DbContext(typeof(BaseServiceMigrationDbContext))]
[Migration("20210127044859_127-2")]
partial class _1272
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseIdentityColumns()
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.Entity("FileStorage.Models.UploadFileInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("FileUrl")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Md5Code")
.HasColumnType("nvarchar(max)");
b.Property<long?>("Size")
.HasColumnType("bigint");
b.Property<string>("Suffix")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("FileName");
b.ToTable("file_info");
});
#pragma warning restore 612, 618
}
}
}

66
Modules/BaseService/BaseService.Host/Migrations/20210127044859_127-2.cs

@ -0,0 +1,66 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FileStorage.Migrations
{
public partial class _1272 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
//migrationBuilder.DropTable(
// name: "AbpBlobs");
//migrationBuilder.DropTable(
// name: "AbpBlobContainers");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpBlobContainers",
columns: table => new
{
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
TempId1 = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.UniqueConstraint("AK_AbpBlobContainers_TempId1", x => x.TempId1);
});
migrationBuilder.CreateTable(
name: "AbpBlobs",
columns: table => new
{
ContainerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Content = table.Column<byte[]>(type: "varbinary(max)", maxLength: 2147483647, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.ForeignKey(
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId",
column: x => x.ContainerId,
principalTable: "AbpBlobContainers",
principalColumn: "TempId1",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_AbpBlobContainers_TenantId_Name",
table: "AbpBlobContainers",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_TenantId_ContainerId_Name",
table: "AbpBlobs",
columns: new[] { "TenantId", "ContainerId", "Name" });
}
}
}

1370
Modules/BaseService/BaseService.Host/Migrations/20210222060956_data0222.Designer.cs

File diff suppressed because it is too large

804
Modules/BaseService/BaseService.Host/Migrations/20210222060956_data0222.cs

@ -0,0 +1,804 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FileStorage.Migrations
{
public partial class data0222 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpAuditLogs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ApplicationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantName = table.Column<string>(type: "nvarchar(max)", nullable: true),
ImpersonatorUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ImpersonatorTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExecutionTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExecutionDuration = table.Column<int>(type: "int", nullable: false),
ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ClientName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
ClientId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CorrelationId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
HttpMethod = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
Url = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Exceptions = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true),
Comments = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
HttpStatusCode = table.Column<int>(type: "int", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpAuditLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpClaimTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Required = table.Column<bool>(type: "bit", nullable: false),
IsStatic = table.Column<bool>(type: "bit", nullable: false),
Regex = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
RegexDescription = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
Description = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ValueType = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpLinkUsers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SourceUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SourceTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TargetUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TargetTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpLinkUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpOrganizationUnits",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id);
table.ForeignKey(
name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId",
column: x => x.ParentId,
principalTable: "AbpOrganizationUnits",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "AbpPermissionGrants",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ProviderName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpRoles",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
IsDefault = table.Column<bool>(type: "bit", nullable: false),
IsStatic = table.Column<bool>(type: "bit", nullable: false),
IsPublic = table.Column<bool>(type: "bit", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSecurityLogs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ApplicationName = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
Identity = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
Action = table.Column<string>(type: "nvarchar(96)", maxLength: 96, nullable: true),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
TenantName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ClientId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
CorrelationId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ClientIpAddress = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
BrowserInfo = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpSettings",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Value = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: false),
ProviderName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
ProviderKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpTenants",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpTenants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpUsers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Surname = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PasswordHash = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
SecurityStamp = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
IsExternal = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
PhoneNumber = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "base_branches",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CategoryId = table.Column<short>(type: "smallint", nullable: false),
Pid = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
FullName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
Sort = table.Column<int>(type: "int", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_base_branches", x => x.Id);
});
migrationBuilder.CreateTable(
name: "base_user_branches",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_base_user_branches", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpAuditLogActions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AuditLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ServiceName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
MethodName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
Parameters = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
ExecutionTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ExecutionDuration = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id);
table.ForeignKey(
name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId",
column: x => x.AuditLogId,
principalTable: "AbpAuditLogs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpEntityChanges",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AuditLogId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ChangeTime = table.Column<DateTime>(type: "datetime2", nullable: false),
ChangeType = table.Column<byte>(type: "tinyint", nullable: false),
EntityTenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
EntityTypeFullName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpEntityChanges", x => x.Id);
table.ForeignKey(
name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId",
column: x => x.AuditLogId,
principalTable: "AbpAuditLogs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpOrganizationUnitRoles",
columns: table => new
{
RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OrganizationUnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId });
table.ForeignKey(
name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId",
column: x => x.OrganizationUnitId,
principalTable: "AbpOrganizationUnits",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId",
column: x => x.RoleId,
principalTable: "AbpRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpRoleClaims",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ClaimType = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpRoleClaims_AbpRoles_RoleId",
column: x => x.RoleId,
principalTable: "AbpRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpTenantConnectionStrings",
columns: table => new
{
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Value = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name });
table.ForeignKey(
name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId",
column: x => x.TenantId,
principalTable: "AbpTenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserClaims",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ClaimType = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AbpUserClaims_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserLogins",
columns: table => new
{
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ProviderKey = table.Column<string>(type: "nvarchar(196)", maxLength: 196, nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider });
table.ForeignKey(
name: "FK_AbpUserLogins_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserOrganizationUnits",
columns: table => new
{
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OrganizationUnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId });
table.ForeignKey(
name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId",
column: x => x.OrganizationUnitId,
principalTable: "AbpOrganizationUnits",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserRoles",
columns: table => new
{
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AbpUserRoles_AbpRoles_RoleId",
column: x => x.RoleId,
principalTable: "AbpRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AbpUserRoles_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpUserTokens",
columns: table => new
{
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AbpUserTokens_AbpUsers_UserId",
column: x => x.UserId,
principalTable: "AbpUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "base_branch_role",
columns: table => new
{
RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_base_branch_role", x => new { x.BranchId, x.RoleId });
table.ForeignKey(
name: "FK_base_branch_role_base_branches_BranchId",
column: x => x.BranchId,
principalTable: "base_branches",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "base_user_branch_role",
columns: table => new
{
UserBranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_base_user_branch_role", x => new { x.UserBranchId, x.Id });
table.ForeignKey(
name: "FK_base_user_branch_role_base_user_branches_UserBranchId",
column: x => x.UserBranchId,
principalTable: "base_user_branches",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AbpEntityPropertyChanges",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
EntityChangeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NewValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
OriginalValue = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
PropertyName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
PropertyTypeFullName = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id);
table.ForeignKey(
name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId",
column: x => x.EntityChangeId,
principalTable: "AbpEntityChanges",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpAuditLogActions_AuditLogId",
table: "AbpAuditLogActions",
column: "AuditLogId");
migrationBuilder.CreateIndex(
name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime",
table: "AbpAuditLogActions",
columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" });
migrationBuilder.CreateIndex(
name: "IX_AbpAuditLogs_TenantId_ExecutionTime",
table: "AbpAuditLogs",
columns: new[] { "TenantId", "ExecutionTime" });
migrationBuilder.CreateIndex(
name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime",
table: "AbpAuditLogs",
columns: new[] { "TenantId", "UserId", "ExecutionTime" });
migrationBuilder.CreateIndex(
name: "IX_AbpEntityChanges_AuditLogId",
table: "AbpEntityChanges",
column: "AuditLogId");
migrationBuilder.CreateIndex(
name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId",
table: "AbpEntityChanges",
columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" });
migrationBuilder.CreateIndex(
name: "IX_AbpEntityPropertyChanges_EntityChangeId",
table: "AbpEntityPropertyChanges",
column: "EntityChangeId");
migrationBuilder.CreateIndex(
name: "IX_AbpLinkUsers_SourceUserId_SourceTenantId_TargetUserId_TargetTenantId",
table: "AbpLinkUsers",
columns: new[] { "SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId" },
unique: true,
filter: "[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId",
table: "AbpOrganizationUnitRoles",
columns: new[] { "RoleId", "OrganizationUnitId" });
migrationBuilder.CreateIndex(
name: "IX_AbpOrganizationUnits_Code",
table: "AbpOrganizationUnits",
column: "Code");
migrationBuilder.CreateIndex(
name: "IX_AbpOrganizationUnits_ParentId",
table: "AbpOrganizationUnits",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey",
table: "AbpPermissionGrants",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpRoleClaims_RoleId",
table: "AbpRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_AbpRoles_NormalizedName",
table: "AbpRoles",
column: "NormalizedName");
migrationBuilder.CreateIndex(
name: "IX_AbpSecurityLogs_TenantId_Action",
table: "AbpSecurityLogs",
columns: new[] { "TenantId", "Action" });
migrationBuilder.CreateIndex(
name: "IX_AbpSecurityLogs_TenantId_ApplicationName",
table: "AbpSecurityLogs",
columns: new[] { "TenantId", "ApplicationName" });
migrationBuilder.CreateIndex(
name: "IX_AbpSecurityLogs_TenantId_Identity",
table: "AbpSecurityLogs",
columns: new[] { "TenantId", "Identity" });
migrationBuilder.CreateIndex(
name: "IX_AbpSecurityLogs_TenantId_UserId",
table: "AbpSecurityLogs",
columns: new[] { "TenantId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_AbpSettings_Name_ProviderName_ProviderKey",
table: "AbpSettings",
columns: new[] { "Name", "ProviderName", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpTenants_Name",
table: "AbpTenants",
column: "Name");
migrationBuilder.CreateIndex(
name: "IX_AbpUserClaims_UserId",
table: "AbpUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AbpUserLogins_LoginProvider_ProviderKey",
table: "AbpUserLogins",
columns: new[] { "LoginProvider", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_AbpUserOrganizationUnits_UserId_OrganizationUnitId",
table: "AbpUserOrganizationUnits",
columns: new[] { "UserId", "OrganizationUnitId" });
migrationBuilder.CreateIndex(
name: "IX_AbpUserRoles_RoleId_UserId",
table: "AbpUserRoles",
columns: new[] { "RoleId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_Email",
table: "AbpUsers",
column: "Email");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_NormalizedEmail",
table: "AbpUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_NormalizedUserName",
table: "AbpUsers",
column: "NormalizedUserName");
migrationBuilder.CreateIndex(
name: "IX_AbpUsers_UserName",
table: "AbpUsers",
column: "UserName");
migrationBuilder.CreateIndex(
name: "IX_base_branches_Pid",
table: "base_branches",
column: "Pid");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpAuditLogActions");
migrationBuilder.DropTable(
name: "AbpClaimTypes");
migrationBuilder.DropTable(
name: "AbpEntityPropertyChanges");
migrationBuilder.DropTable(
name: "AbpLinkUsers");
migrationBuilder.DropTable(
name: "AbpOrganizationUnitRoles");
migrationBuilder.DropTable(
name: "AbpPermissionGrants");
migrationBuilder.DropTable(
name: "AbpRoleClaims");
migrationBuilder.DropTable(
name: "AbpSecurityLogs");
migrationBuilder.DropTable(
name: "AbpSettings");
migrationBuilder.DropTable(
name: "AbpTenantConnectionStrings");
migrationBuilder.DropTable(
name: "AbpUserClaims");
migrationBuilder.DropTable(
name: "AbpUserLogins");
migrationBuilder.DropTable(
name: "AbpUserOrganizationUnits");
migrationBuilder.DropTable(
name: "AbpUserRoles");
migrationBuilder.DropTable(
name: "AbpUserTokens");
migrationBuilder.DropTable(
name: "base_branch_role");
migrationBuilder.DropTable(
name: "base_user_branch_role");
migrationBuilder.DropTable(
name: "AbpEntityChanges");
migrationBuilder.DropTable(
name: "AbpTenants");
migrationBuilder.DropTable(
name: "AbpOrganizationUnits");
migrationBuilder.DropTable(
name: "AbpRoles");
migrationBuilder.DropTable(
name: "AbpUsers");
migrationBuilder.DropTable(
name: "base_branches");
migrationBuilder.DropTable(
name: "base_user_branches");
migrationBuilder.DropTable(
name: "AbpAuditLogs");
}
}
}

1379
Modules/BaseService/BaseService.Host/Migrations/20210228094753_data228.Designer.cs

File diff suppressed because it is too large

45
Modules/BaseService/BaseService.Host/Migrations/20210228094753_data228.cs

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FileStorage.Migrations
{
public partial class data228 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CascadeId",
table: "base_branches",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "Leaf",
table: "base_branches",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<Guid>(
name: "TenantId",
table: "base_branches",
type: "uniqueidentifier",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CascadeId",
table: "base_branches");
migrationBuilder.DropColumn(
name: "Leaf",
table: "base_branches");
migrationBuilder.DropColumn(
name: "TenantId",
table: "base_branches");
}
}
}

1373
Modules/BaseService/BaseService.Host/Migrations/20210305072640_data20210305.Designer.cs

File diff suppressed because it is too large

24
Modules/BaseService/BaseService.Host/Migrations/20210305072640_data20210305.cs

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace FileStorage.Migrations
{
public partial class data20210305 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "base_user_branches");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "base_user_branches",
type: "bit",
nullable: false,
defaultValue: false);
}
}
}

64
Modules/BaseService/BaseService.Host/Program.cs

@ -0,0 +1,64 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
// using Serilog.Sinks.Elasticsearch;
namespace BaseService
{
public class Program
{
public static int Main(string[] args)
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables()
.Build();
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.WithProperty("Application", "BaseService")
.Enrich.FromLogContext()
.WriteTo.File("Logs/logs.txt")
// .WriteTo.Elasticsearch(
// new ElasticsearchSinkOptions(new Uri(configuration["ElasticSearch:Url"]))
// {
// AutoRegisterTemplate = true,
// AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6,
// IndexFormat = "xdl-log-{0:yyyy.MM}"
// })
.WriteTo.Console()
.CreateLogger();
try
{
Log.Information("Starting BaseService.Host.");
CreateHostBuilder(args).Build().Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "BaseService.Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseAutofac()
.UseSerilog();
}
}

27
Modules/BaseService/BaseService.Host/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:10130",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BaseService.Host": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:10130",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

20
Modules/BaseService/BaseService.Host/Startup.cs

@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace BaseService
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<BaseServiceHostModule>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}
}

9
Modules/BaseService/BaseService.Host/appsettings.Development.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

39
Modules/BaseService/BaseService.Host/appsettings.json

@ -0,0 +1,39 @@
{
"AuthServer": {
"Authority": "http://localhost:10100",
"ApiName": "IdentityService"
},
"App": {
"CorsOrigins": "http://localhost:9527,http://localhost:9528"
},
"ConnectionStrings": {
"Default": "Server=124.220.28.250;Database=ABP;User ID=sa;Password=Microsoft2008;"
//"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft@2021;"
// "Default": "Server=LAPTOP-V3U07C2O;Database=ABP;User ID=sa;Password=1q2w!@#;"
//"Default": "Server=114.116.225.148,13314;Database=ABP;User ID=sa;Password=Microsoft2020;"
},
"ElasticSearch": {
"Url": "http://localhost:9200"
},
"Redis": {
"Configuration": "127.0.0.1"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
//"Settings": {
// "Abp.Localization.DefaultLanguage": "zh-Hans",
// "Abp.Identity.Password.RequireNonAlphanumeric": "false", //
// "Abp.Identity.Password.RequireUppercase": "false", //
// "Abp.Identity.Password.RequireLowercase": "false", //
// "Abp.Identity.Password.RequiredLength": "1",
// "Abp.Identity.SignIn.RequireConfirmedEmail": "true",
// //
// "Abp.Identity.Lockout.AllowedForNewUsers": "true",
// "Abp.Identity.Lockout.MaxFailedAccessAttempts": "3"
//},
"AllowedHosts": "*",
"Urls": "http://*:8055"
}

14
Modules/BaseService/BaseService.Host/src/Modules/BaseService/BaseService.Host/BaseService.Host.xml

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>BaseService.Host</name>
</assembly>
<members>
<member name="M:BaseService.BaseServiceHostModule.ConfigurePasswordSet(Volo.Abp.Modularity.ServiceConfigurationContext)">
<summary>
设置密码强度
</summary>
<param name="context"></param>
</member>
</members>
</doc>

14
Modules/BaseService/BaseService.HttpApi.Client/BaseService.HttpApi.Client.csproj

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
</ItemGroup>
</Project>

1
Modules/BaseService/BaseService.HttpApi/BaseData/OrganizationController.cs

@ -0,0 +1 @@


70
Modules/BaseService/BaseService.HttpApi/BaseData/UserBranchRoleController.cs

@ -0,0 +1,70 @@
//using BaseService.Controllers;
//using Microsoft.AspNetCore.Mvc;
//using System;
//using System.Collections.Generic;
//using System.Text;
//using System.Threading.Tasks;
//using BaseService.BaseData.UserBranchRoleManagement;
//using BaseService.BaseData.UserBranchRoleManagement.Dto;
//using Volo.Abp.Application.Dtos;
//namespace BaseService.HttpApi.BaseData
//{
// [Area("base")]
// [Route("api/base/userBranchRole")]
// public class UserBranchRoleController : BaseServiceController, IUserBranchAppService
// {
// private readonly IUserBranchAppService _jobAppService;
// public UserBranchRoleController(IUserBranchAppService jobAppService)
// {
// _jobAppService = jobAppService;
// }
// [HttpPost]
// public Task<UserBranchDto> CreateAsync(CreateOrUpdateUserBranchDto input)
// {
// return _jobAppService.CreateAsync(input);
// }
// [HttpPost]
// [Route("delete")]
// public Task DeleteAsync(List<Guid> ids)
// {
// return _jobAppService.DeleteAsync(ids);
// }
// /// <summary>
// /// 获取单条数据
// /// </summary>
// /// <param name="id"></param>
// /// <returns></returns>
// [HttpGet]
// [Route("{id}")]
// public Task<UserBranchDto> GetAsync(Guid id)
// {
// return _jobAppService.GetAsync(id);
// }
// [HttpGet]
// [Route("all")]
// public Task<PagedResultDto<UserBranchDto>> GetPagedListAsync(GetUserBranchInput input)
// {
// return _jobAppService.GetPagedListAsync(input);
// }
// //[HttpGet]
// //[Route("userbranchroles")]
// //public Task<ListResultDto<UserBranchDto>> GetAllAsync()
// //{
// // return _jobAppService.GetAllAsync();
// //}
// [HttpPut]
// [Route("{id}")]
// public Task<UserBranchDto> UpdateAsync(Guid id, CreateOrUpdateUserBranchDto input)
// {
// return _jobAppService.UpdateAsync(id, input);
// }
// }
//}

19
Modules/BaseService/BaseService.HttpApi/BaseService.HttpApi.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Settings" Version="4.3.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseService.Application.Contracts\BaseService.Application.Contracts.csproj" />
</ItemGroup>
</Project>

165
Modules/BaseService/BaseService.HttpApi/BaseService.HttpApi.xml

@ -0,0 +1,165 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>BaseService.HttpApi</name>
</assembly>
<members>
<member name="T:BaseService.BaseData.BranchController">
<summary>
分支管理
</summary>
</member>
<member name="M:BaseService.BaseData.BranchController.#ctor(BaseService.BaseData.BranchManagement.IBranchAppService)">
<summary>
分支管理-依赖注入
</summary>
<param name="branchAppService"></param>
</member>
<member name="M:BaseService.BaseData.BranchController.Create(BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto)">
<summary>
创建分支信息
</summary>
<param name="input">输入项</param>
<returns></returns>
</member>
<member name="M:BaseService.BaseData.BranchController.Delete(System.Collections.Generic.List{System.Guid})">
<summary>
删除操作(支持批量删除)
</summary>
<param name="ids">传入的id集合</param>
<returns></returns>
</member>
<member name="M:BaseService.BaseData.BranchController.Get(System.Guid)">
<summary>
根据id获取分支的单条信息
</summary>
<param name="id">分支id</param>
<returns></returns>
</member>
<member name="M:BaseService.BaseData.BranchController.GetAll(BaseService.BaseData.BranchManagement.Dto.GetBranchInputDto)">
<summary>
获取全部分支信息(支持分页)
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.BaseData.BranchController.LoadAll(System.Nullable{System.Guid},System.String)">
<summary>
获取全部分支信息(不支持分页)
</summary>
<param name="id">传入的分支id</param>
<param name="filter">过滤条件</param>
<returns></returns>
</member>
<member name="M:BaseService.BaseData.BranchController.LoadAllNodes">
<summary>
获取树形结构数据
</summary>
<returns></returns>
</member>
<member name="M:BaseService.BaseData.BranchController.Update(System.Guid,BaseService.BaseData.BranchManagement.Dto.CreateOrUpdateBranchDto)">
<summary>
修改分支操作
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.BaseData.BranchController.LoadAllRolesByBranchId(System.Guid)">
<summary>
根据分支ID获取分支对应的角色信息
</summary>
<param name="rolesbybranchId">分支</param>
<returns></returns>ID
</member>
<member name="M:BaseService.BaseData.BranchController.GetListByBranchIdAsync(System.Guid,Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto)">
<summary>
根据分支ID,查对应的权限列表
</summary>
<param name="rolesbybranchId">分支ID</param>
<param name="input">分页查询</param>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.BaseData.UserBranchRoleController.Get(System.Guid)">
<summary>
获取单条数据
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:BaseService.HttpApi.Systems.UserController">
<summary>
用户管理
</summary>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.#ctor(BaseService.Systems.UserManagement.IUserAppService)">
<summary>
构造函数
</summary>
<param name="userAppService"></param>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.Create(Volo.Abp.Identity.IdentityUserCreateDto)">
<summary>
创建用户信息
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.Get(System.Guid)">
<summary>
根据用户ID获取用户信息
</summary>
<param name="id">分支ID</param>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.GetCurrentUserInfo">
<summary>
获取当前登录用户的信息
</summary>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.GetAll(Volo.Abp.Identity.GetIdentityUsersInput)">
<summary>
获取所有用户信息(分页操作)
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.UpdateAsync(System.Guid,Volo.Abp.Identity.IdentityUserUpdateDto)">
<summary>
根据用户ID进行修改操作
</summary>
<param name="id">用户ID</param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.LoadAllBranchesByUserId(System.Guid)">
<summary>
根据当前登录用户ID获取其所有分支信息
</summary>
<param name="rolesbyuserId">用户ID</param>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.GetAuthConfigAsync(System.Guid)">
<summary>
根据当前登录用户的分支ID,获取权限信息
</summary>
<param name="branchId">分支ID</param>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.LoadAllCurrentUserBranches">
<summary>
获取当前登录用户的所有分支信息
</summary>
<returns></returns>
</member>
<member name="M:BaseService.HttpApi.Systems.UserController.ResetPasswordCurrentUser(System.Guid)">
<summary>
重置密码功能
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
</members>
</doc>

21
Modules/BaseService/BaseService.HttpApi/BaseServiceHttpApiModule.cs

@ -0,0 +1,21 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
namespace BaseService
{
[DependsOn(
typeof(BaseServiceApplicationContractsModule),
typeof(AbpAspNetCoreMvcModule)
)]
public class BaseServiceHttpApiModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<IMvcBuilder>(mvcBuilder =>
{
mvcBuilder.AddApplicationPartIfNotExists(typeof(BaseServiceHttpApiModule).Assembly);
});
}
}
}

13
Modules/BaseService/BaseService.HttpApi/Controllers/BaseServiceController.cs

@ -0,0 +1,13 @@
using BaseService.Localization;
using Volo.Abp.AspNetCore.Mvc;
namespace BaseService.Controllers
{
public abstract class BaseServiceController : AbpController
{
protected BaseServiceController()
{
LocalizationResource = typeof(BaseServiceResource);
}
}
}

48
Modules/BaseService/BaseService.HttpApi/Systems/UserController.cs

@ -0,0 +1,48 @@
//using BaseService.Controllers;
//using BaseService.Systems.UserManagement;
//using Microsoft.AspNetCore.Mvc;
//using System;
//using System.Threading.Tasks;
//using Volo.Abp.Application.Dtos;
//using Volo.Abp.Identity;
//namespace BaseService.HttpApi.Systems
//{
// [Area("base")]
// [Route("api/base/user")]
// public class UserController: BaseServiceController,IUserAppService
// {
// private readonly IUserAppService _userAppService;
// public UserController(IUserAppService userAppService)
// {
// _userAppService = userAppService;
// }
// [HttpPost]
// public Task<IdentityUserDto> Create(IdentityUserCreateDto input)
// {
// return _userAppService.Create(input);
// }
// [HttpGet]
// [Route("{id}")]
// public Task<IdentityUserDto> Get(Guid id)
// {
// return _userAppService.Get(id);
// }
// [HttpGet]
// public Task<PagedResultDto<IdentityUserDto>> GetAll(GetIdentityUsersInput input)
// {
// return _userAppService.GetAll(input);
// }
// [HttpPut]
// [Route("{id}")]
// public Task<IdentityUserDto> UpdateAsync(Guid id, IdentityUserUpdateDto input)
// {
// return _userAppService.UpdateAsync(id, input);
// }
// }
//}

72
Modules/BaseService/BaseService.sln

@ -0,0 +1,72 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29326.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaseService.Host", "BaseService.Host\BaseService.Host.csproj", "{42E8F7A4-592B-4BED-8F06-16487B1A3626}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaseService.Domain", "BaseService.Domain\BaseService.Domain.csproj", "{7DD4C936-0527-486E-AC94-AF8DDCB01AB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaseService.Application.Contracts", "BaseService.Application.Contracts\BaseService.Application.Contracts.csproj", "{9D96AE95-4F99-45DC-943F-AE53FDCCE2A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaseService.Application", "BaseService.Application\BaseService.Application.csproj", "{3B3DF78E-1120-4C16-A0F8-6220F8E42710}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaseService.EntityFrameworkCore", "BaseService.EntityFrameworkCore\BaseService.EntityFrameworkCore.csproj", "{4EB88A8D-20B5-45FA-94EA-88762BDCD89A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaseService.HttpApi", "BaseService.HttpApi\BaseService.HttpApi.csproj", "{58888939-5192-4FF1-847E-487C47F2FFE9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaseService.HttpApi.Client", "BaseService.HttpApi.Client\BaseService.HttpApi.Client.csproj", "{A1607874-E2BF-4B93-B81A-54505FCB5739}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{25A38556-59BC-4516-A9F4-1ECE4FBF8438}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42E8F7A4-592B-4BED-8F06-16487B1A3626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42E8F7A4-592B-4BED-8F06-16487B1A3626}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42E8F7A4-592B-4BED-8F06-16487B1A3626}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42E8F7A4-592B-4BED-8F06-16487B1A3626}.Release|Any CPU.Build.0 = Release|Any CPU
{7DD4C936-0527-486E-AC94-AF8DDCB01AB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DD4C936-0527-486E-AC94-AF8DDCB01AB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DD4C936-0527-486E-AC94-AF8DDCB01AB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DD4C936-0527-486E-AC94-AF8DDCB01AB4}.Release|Any CPU.Build.0 = Release|Any CPU
{9D96AE95-4F99-45DC-943F-AE53FDCCE2A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D96AE95-4F99-45DC-943F-AE53FDCCE2A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D96AE95-4F99-45DC-943F-AE53FDCCE2A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D96AE95-4F99-45DC-943F-AE53FDCCE2A4}.Release|Any CPU.Build.0 = Release|Any CPU
{3B3DF78E-1120-4C16-A0F8-6220F8E42710}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B3DF78E-1120-4C16-A0F8-6220F8E42710}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B3DF78E-1120-4C16-A0F8-6220F8E42710}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B3DF78E-1120-4C16-A0F8-6220F8E42710}.Release|Any CPU.Build.0 = Release|Any CPU
{4EB88A8D-20B5-45FA-94EA-88762BDCD89A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EB88A8D-20B5-45FA-94EA-88762BDCD89A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EB88A8D-20B5-45FA-94EA-88762BDCD89A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EB88A8D-20B5-45FA-94EA-88762BDCD89A}.Release|Any CPU.Build.0 = Release|Any CPU
{58888939-5192-4FF1-847E-487C47F2FFE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58888939-5192-4FF1-847E-487C47F2FFE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58888939-5192-4FF1-847E-487C47F2FFE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58888939-5192-4FF1-847E-487C47F2FFE9}.Release|Any CPU.Build.0 = Release|Any CPU
{A1607874-E2BF-4B93-B81A-54505FCB5739}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1607874-E2BF-4B93-B81A-54505FCB5739}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1607874-E2BF-4B93-B81A-54505FCB5739}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1607874-E2BF-4B93-B81A-54505FCB5739}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{42E8F7A4-592B-4BED-8F06-16487B1A3626} = {25A38556-59BC-4516-A9F4-1ECE4FBF8438}
{7DD4C936-0527-486E-AC94-AF8DDCB01AB4} = {25A38556-59BC-4516-A9F4-1ECE4FBF8438}
{9D96AE95-4F99-45DC-943F-AE53FDCCE2A4} = {25A38556-59BC-4516-A9F4-1ECE4FBF8438}
{3B3DF78E-1120-4C16-A0F8-6220F8E42710} = {25A38556-59BC-4516-A9F4-1ECE4FBF8438}
{4EB88A8D-20B5-45FA-94EA-88762BDCD89A} = {25A38556-59BC-4516-A9F4-1ECE4FBF8438}
{58888939-5192-4FF1-847E-487C47F2FFE9} = {25A38556-59BC-4516-A9F4-1ECE4FBF8438}
{A1607874-E2BF-4B93-B81A-54505FCB5739} = {25A38556-59BC-4516-A9F4-1ECE4FBF8438}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9CC60D9C-D24A-4113-9CF0-40976568F193}
EndGlobalSection
EndGlobal

16
Modules/BaseService/README.md

@ -0,0 +1,16 @@
#SmartFactorySuite
##Base Service
##服务端口列表
* WebApp 10000
* AuthServer 10100
* InternalGateway 10110
* WebAppGateway 10120
* BaseService 10130
* MasterService 10200
* Redis 6379
* ElasticSearch 9200
* SqlServer 13314

1
Modules/新版JIT或JIS系统服务端/.gitattributes

@ -0,0 +1 @@
**/wwwroot/libs/** linguist-vendored

266
Modules/新版JIT或JIS系统服务端/.gitignore

@ -0,0 +1,266 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
**/bin/
**/obj/
**/Logs/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# NewJit
src/WY.NewJit.Web/Logs/*
src/WY.NewJit.Web.Host/Logs/*
src/WY.NewJit.IdentityServer/Logs/*
src/WY.NewJit.HttpApi.Host/Logs/*
src/WY.NewJit.HttpApi.HostWithIds/Logs/*
src/WY.NewJit.DbMigrator/Logs/*
src/WY.NewJit.Blazor.Server/Logs/*
src/WY.NewJit.Blazor.Server.Tiered/Logs/*

5
Modules/新版JIT或JIS系统服务端/.prettierrc

@ -0,0 +1,5 @@
{
"singleQuote": true,
"useTabs": false,
"tabWidth": 4
}

6
Modules/新版JIT或JIS系统服务端/NuGet.Config

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="BlazoriseMyGet" value="https://www.myget.org/F/blazorise/api/v3/index.json" />
</packageSources>
</configuration>

BIN
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.7z

Binary file not shown.

BIN
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.bz2

Binary file not shown.

BIN
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.gz

Binary file not shown.

BIN
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.tar

Binary file not shown.

BIN
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/archive/empty.zip

Binary file not shown.

BIN
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/document/empty.docx

Binary file not shown.

BIN
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/document/empty.odt

Binary file not shown.

12
Modules/新版JIT或JIS系统服务端/OutPut/net5.0/EmptyFiles/document/empty.pdf

@ -0,0 +1,12 @@
%PDF-1.0
1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj 2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj 3 0 obj<</Type/Page/MediaBox[0 0 3 3]>>endobj
xref
0 4
0000000000 65535 f
0000000010 00000 n
0000000053 00000 n
0000000102 00000 n
trailer<</Size 4/Root 1 0 R>>
startxref
149
%EOF

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save