diff --git a/aspnet-core/Delete-BIN-OBJ-Folders.bat b/aspnet-core/Delete-BIN-OBJ-Folders.bat
new file mode 100644
index 00000000..02cfaa5e
--- /dev/null
+++ b/aspnet-core/Delete-BIN-OBJ-Folders.bat
@@ -0,0 +1,20 @@
+@ECHO off
+cls
+
+ECHO Deleting all BIN and OBJ folders...
+ECHO.
+
+FOR /d /r . %%d in (bin,obj) DO (
+ IF EXIST "%%d" (
+ ECHO %%d | FIND /I "\node_modules\" > Nul && (
+ ECHO.Skipping: %%d
+ ) || (
+ ECHO.Deleting: %%d
+ rd /s/q "%%d"
+ )
+ )
+)
+
+ECHO.
+ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
+pause > nul
\ No newline at end of file
diff --git a/aspnet-core/frameworks/Extensions/src/Lion.AbpPro.Extension/System/DateTimeExtensions.cs b/aspnet-core/frameworks/Extensions/src/Lion.AbpPro.Extension/System/DateTimeExtensions.cs
index 99b1bef9..1d23b6c2 100644
--- a/aspnet-core/frameworks/Extensions/src/Lion.AbpPro.Extension/System/DateTimeExtensions.cs
+++ b/aspnet-core/frameworks/Extensions/src/Lion.AbpPro.Extension/System/DateTimeExtensions.cs
@@ -75,5 +75,30 @@ namespace Lion.AbpPro.Extension.System
var result = length == 10 ? start.AddSeconds(jsTime) : start.AddMilliseconds(jsTime);
return result.ToUniversalTime();
}
+
+ ///
+ /// 获取指定日期 当天的最大时间
+ /// 例如 2021-09-10 11:22:33.123456 转换后 2021-09-10 23:59:59.9999999
+ ///
+ public static DateTime? ToCurrentDateMaxDateTime(this DateTime? dateTime)
+ {
+ return dateTime?.Date.AddDays(1).AddTicks(-1);
+ }
+
+ ///
+ /// 获取指定时间的下一秒
+ /// 例如 2021-09-10 11:11:11.1234567 转换后 2021-09-10 11:11:12.0000000
+ ///
+ public static DateTime? ToNextSecondDateTime(this DateTime? dateTime)
+ {
+ if (!dateTime.HasValue)
+ {
+ return null;
+ }
+
+ return new DateTime(dateTime.Value.Year, dateTime.Value.Month, dateTime.Value.Day, dateTime.Value.Hour,
+ dateTime.Value.Minute, dateTime.Value.Second)
+ .AddSeconds(1);
+ }
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaries/DataDictionaryDomainException.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaries/DataDictionaryDomainException.cs
index 8a4d320a..555d5eaa 100644
--- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaries/DataDictionaryDomainException.cs
+++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaries/DataDictionaryDomainException.cs
@@ -5,16 +5,17 @@ using Volo.Abp;
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
{
- public class DataDictionaryDomainException : UserFriendlyException
+ public class DataDictionaryDomainException : BusinessException
{
- public DataDictionaryDomainException(string message, string code = null, string details = null,
- Exception innerException = null, LogLevel logLevel = LogLevel.Warning) : base(message, code, details,
- innerException, logLevel)
+ public DataDictionaryDomainException(string code = null, string message = null, string details = null, Exception innerException = null,
+ LogLevel logLevel = LogLevel.Warning) : base(code, message, details,
+ innerException,
+ logLevel
+ )
{
}
- public DataDictionaryDomainException(SerializationInfo serializationInfo, StreamingContext context) : base(
- serializationInfo, context)
+ public DataDictionaryDomainException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context)
{
}
}
diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementConsts.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementConsts.cs
index 63e08e03..044e7116 100644
--- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementConsts.cs
+++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementConsts.cs
@@ -5,5 +5,10 @@ namespace Lion.AbpPro.DataDictionaryManagement
public class DataDictionaryManagementConsts
{
public static Guid SeedDataDictionaryId = new Guid("39fdb236-a90e-e4b5-02a0-2866a8cf9821");
+
+ /// 名称空间
+ public const string NameSpace = "Lion.AbpPro.DataDictionaryManagement";
+ /// 默认语言
+ public const string DefaultCultureName = "zh-Hans";
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementDomainSharedModule.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementDomainSharedModule.cs
index af6ac4ba..d61879cb 100644
--- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementDomainSharedModule.cs
+++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementDomainSharedModule.cs
@@ -23,14 +23,14 @@ namespace Lion.AbpPro.DataDictionaryManagement
Configure(options =>
{
options.Resources
- .Add("en")
+ .Add(DataDictionaryManagementConsts.DefaultCultureName)
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/DataDictionaryManagement");
});
Configure(options =>
{
- options.MapCodeNamespace("DataDictionaryManagement", typeof(DataDictionaryManagementResource));
+ options.MapCodeNamespace(DataDictionaryManagementConsts.NameSpace, typeof(DataDictionaryManagementResource));
});
}
}
diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementErrorCodes.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementErrorCodes.cs
index d5dfaa24..d38c19c1 100644
--- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementErrorCodes.cs
+++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/DataDictionaryManagementErrorCodes.cs
@@ -2,6 +2,9 @@ namespace Lion.AbpPro.DataDictionaryManagement
{
public static class DataDictionaryManagementErrorCodes
{
- //Add your business exception error codes here...
+ public const string DataDictionaryExist =DataDictionaryManagementConsts.NameSpace+ ":100001";
+ public const string DataDictionaryNotExist =DataDictionaryManagementConsts.NameSpace+ ":100002";
+ public const string DataDictionaryDetailExist =DataDictionaryManagementConsts.NameSpace+ ":100003";
+ public const string DataDictionaryDetailNotExist =DataDictionaryManagementConsts.NameSpace+ ":100004";
}
}
diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json
index c2224548..bc54b8fc 100644
--- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json
+++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json
@@ -6,6 +6,12 @@
"Permission:DataDictionaryManagement": "DataDictionaryManagement",
"Permission:Create": "Create",
"Permission:Update": "Update",
- "Permission:Delete": "Delete"
+ "Permission:Delete": "Delete",
+
+ "Lion.AbpPro.DataDictionaryManagement:100001": "DataDictionary Exist",
+ "Lion.AbpPro.DataDictionaryManagement:100002": "DataDictionary Not Exist",
+ "Lion.AbpPro.DataDictionaryManagement:100003": "DataDictionaryDetail Exist",
+ "Lion.AbpPro.DataDictionaryManagement:100004": "DataDictionaryDetail Not Exist"
+
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json
index f463a7e2..5037b4f5 100644
--- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json
+++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json
@@ -6,6 +6,11 @@
"Permission:DataDictionaryManagement": "数据字典",
"Permission:Create": "创建",
"Permission:Update": "编辑",
- "Permission:Delete": "删除"
+ "Permission:Delete": "删除",
+
+ "Lion.AbpPro.DataDictionaryManagement:100001": "数据字典已存在",
+ "Lion.AbpPro.DataDictionaryManagement:100002": "数据字典不存在",
+ "Lion.AbpPro.DataDictionaryManagement:100003": "数据字典明细已存在",
+ "Lion.AbpPro.DataDictionaryManagement:100004": "数据字典明细不存在"
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs
index 6f44c722..e9810dca 100644
--- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs
+++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs
@@ -4,8 +4,8 @@ using System.Threading;
using System.Threading.Tasks;
using Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates;
using Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dto;
+using Volo.Abp;
using Volo.Abp.Caching;
-using Volo.Abp.Domain.Services;
namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
{
@@ -22,22 +22,28 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
_cache = cache;
}
-
-
-
+
public async Task FindByIdAsync(
Guid id,
CancellationToken cancellationToken = default)
{
var cacheKey = DataDictionaryDto.CalculateCacheKey(id, null);
- return await _cache.GetOrAddAsync(cacheKey,
+ return await _cache.GetOrAddAsync
+ (
+ cacheKey,
async () =>
{
var entity =
- await _dataDictionaryRepository.FindByIdAsync(id, true,
- cancellationToken);
+ await _dataDictionaryRepository.FindByIdAsync
+ (
+ id,
+ true,
+ cancellationToken
+ );
return ObjectMapper.Map(entity);
- }, token: cancellationToken);
+ },
+ token: cancellationToken
+ );
}
public async Task FindByCodeAsync(
@@ -45,14 +51,22 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
CancellationToken cancellationToken = default)
{
var cacheKey = DataDictionaryDto.CalculateCacheKey(null, code);
- return await _cache.GetOrAddAsync(cacheKey,
+ return await _cache.GetOrAddAsync
+ (
+ cacheKey,
async () =>
{
var entity =
- await _dataDictionaryRepository.FindByCodeAsync(code, true,
- cancellationToken);
+ await _dataDictionaryRepository.FindByCodeAsync
+ (
+ code,
+ true,
+ cancellationToken
+ );
return ObjectMapper.Map(entity);
- }, token: cancellationToken);
+ },
+ token: cancellationToken
+ );
}
@@ -62,10 +76,21 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
///
///
///
- public Task CreateAsync(string code, string displayText, string description)
+ public async Task CreateAsync(string code, string displayText, string description)
{
- var entity = new DataDictionary(GuidGenerator.Create(), code, displayText, description);
- return _dataDictionaryRepository.InsertAsync(entity);
+ Check.NotNullOrWhiteSpace(code, nameof(code));
+ var entity = await _dataDictionaryRepository.FindByCodeAsync(code);
+ if (entity != null) throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryExist);
+
+ entity = new DataDictionary
+ (
+ GuidGenerator.Create(),
+ code,
+ displayText,
+ description
+ );
+
+ return await _dataDictionaryRepository.InsertAsync(entity);
}
///
@@ -77,36 +102,47 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
///
///
///
- public async Task CreateDetailAsync(Guid dataDictionaryId, string code,
+ public async Task CreateDetailAsync(
+ Guid dataDictionaryId,
+ string code,
string displayText,
string description,
int order)
{
var entity = await _dataDictionaryRepository.FindByIdAsync(dataDictionaryId);
if (entity == null)
- throw new DataDictionaryDomainException(message: "数据字典不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryNotExist);
if (entity.Details.Any(e => e.Code == code.Trim()))
{
- throw new DataDictionaryDomainException(message: $"字典项{code}已存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryDetailExist);
}
- entity.AddDetail(GuidGenerator.Create(), code, displayText, order, description);
+ entity.AddDetail
+ (
+ GuidGenerator.Create(),
+ code,
+ displayText,
+ order,
+ description
+ );
return await _dataDictionaryRepository.UpdateAsync(entity);
}
///
/// 设置字典明细状态
///
- public async Task SetStatus(Guid dataDictionaryId,
- Guid dataDictionayDetailId, bool isEnabled)
+ public async Task SetStatus(
+ Guid dataDictionaryId,
+ Guid dataDictionayDetailId,
+ bool isEnabled)
{
var entity = await _dataDictionaryRepository.FindByIdAsync(dataDictionaryId);
if (entity == null)
- throw new DataDictionaryDomainException(message: "数据字典不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryNotExist);
var detail = entity.Details.FirstOrDefault(e => e.Id == dataDictionayDetailId);
if (null == detail)
{
- throw new DataDictionaryDomainException(message: $"字典项不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryDetailExist);
}
detail.SetIsEnabled(isEnabled);
@@ -125,14 +161,20 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
{
var entity = await _dataDictionaryRepository.FindByIdAsync(dataDictionaryId);
if (entity == null)
- throw new DataDictionaryDomainException(message: "数据字典不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryNotExist);
var detail = entity.Details.FirstOrDefault(e => e.Id == dataDictionayDetailId);
if (null == detail)
{
- throw new DataDictionaryDomainException(message: $"字典项不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryDetailNotExist);
}
- detail.UpdateDetail(dataDictionayDetailId, displayText, description, order);
+ detail.UpdateDetail
+ (
+ dataDictionayDetailId,
+ displayText,
+ description,
+ order
+ );
return await _dataDictionaryRepository.UpdateAsync(entity);
}
@@ -140,27 +182,29 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
{
var entity = await _dataDictionaryRepository.FindByIdAsync(dataDictionaryId);
if (entity == null)
- throw new DataDictionaryDomainException(message: "数据字典不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryNotExist);
var detail = entity.Details.FirstOrDefault(e => e.Id == dataDictionayDetailId);
if (null == detail)
{
- throw new DataDictionaryDomainException(message: $"字典项不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryDetailNotExist);
}
entity.Details.Remove(detail);
await _dataDictionaryRepository.UpdateAsync(entity);
}
- public async Task UpdateAsync(Guid dataDictionaryId,
+
+ public async Task UpdateAsync(
+ Guid dataDictionaryId,
string displayText,
string description)
{
var entity = await _dataDictionaryRepository.FindByIdAsync(dataDictionaryId);
if (entity == null)
- throw new DataDictionaryDomainException(message: "数据字典不存在");
- entity.Update(dataDictionaryId,displayText,description);
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryNotExist);
+ entity.Update(dataDictionaryId, displayText, description);
return await _dataDictionaryRepository.UpdateAsync(entity);
-
}
+
///
/// 删除字典类型
///
@@ -170,13 +214,14 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries
{
var entity = await _dataDictionaryRepository.FindByIdAsync(id);
if (entity == null)
- throw new DataDictionaryDomainException(message: "数据字典不存在");
+ throw new DataDictionaryDomainException(DataDictionaryManagementErrorCodes.DataDictionaryNotExist);
var detail = entity.Details.FirstOrDefault(e => e.DataDictionaryId == id);
- if (detail !=null )
+ if (detail != null)
{
entity.Details.Remove(detail);
await _dataDictionaryRepository.UpdateAsync(entity);
}
+
await _dataDictionaryRepository.DeleteAsync(id);
}
}
diff --git a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/appsettings.json b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/appsettings.json
index 5b227b43..8b9c4f55 100644
--- a/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/appsettings.json
+++ b/aspnet-core/modules/FileManagement/host/Lion.AbpPro.FileManagement.HttpApi.Host/appsettings.json
@@ -18,9 +18,4 @@
"RoleArn": "acs:ram::1846393972471789:role/ramosstest"
}
}
-}
-
-//用户登录名称 lion.abp@1846393972471789.onaliyun.com
-//AccessKey ID LTAI5tLkt3vvScGPVZ5qKJDc
-//AccessKey Secret BixV8vP5uPrbsdwjYzzsEXOPjkxPST
-//acs:ram::1846393972471789:role/ramosstest
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs
index 38336347..c289bb57 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs
@@ -55,7 +55,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
await SendMessageToAllClientAsync(new SendNotificationDto(title, content, messageType));
break;
default:
- throw new UserFriendlyException("未知的消息类型");
+ throw new BusinessException(NotificationManagementErrorCodes.MessageTypeUnknown);
}
}
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json
index f39af7fc..04b81cc4 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json
@@ -2,6 +2,10 @@
"culture": "en",
"texts": {
"ManageYourProfile": "Manage your profile",
- "SamplePageMessage": "A sample page for the NotificationManagement module"
+ "SamplePageMessage": "A sample page for the NotificationManagement module",
+ "Lion.AbpPro.NotificationManagement:100001": "ReceiverNotNull",
+ "Lion.AbpPro.NotificationManagement:100002": "MessageNotExist",
+ "Lion.AbpPro.NotificationManagement:100003": "MessageTypeUnknown",
+ "Lion.AbpPro.NotificationManagement:100004": "UserUnSubscription"
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json
index 01c3e18d..9ceaf7fb 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json
@@ -2,6 +2,11 @@
"culture": "zh-Hans",
"texts": {
"ManageYourProfile": "管理个人资料",
- "SamplePageMessage": "NotificationManagement模块的示例页面"
+ "SamplePageMessage": "NotificationManagement模块的示例页面",
+
+ "Lion.AbpPro.NotificationManagement:100001": "接收人不能为空",
+ "Lion.AbpPro.NotificationManagement:100002": "消息不存在",
+ "Lion.AbpPro.NotificationManagement:100003": "未知的消息类型",
+ "Lion.AbpPro.NotificationManagement:100004": "当前用户未订阅消息"
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementConsts.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementConsts.cs
new file mode 100644
index 00000000..27c6d065
--- /dev/null
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementConsts.cs
@@ -0,0 +1,9 @@
+namespace Lion.AbpPro.NotificationManagement;
+
+public class NotificationManagementConsts
+{
+ /// 名称空间
+ public const string NameSpace = "Lion.AbpPro.NotificationManagementConsts";
+ /// 默认语言
+ public const string DefaultCultureName = "zh-Hans";
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementDomainSharedModule.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementDomainSharedModule.cs
index 2dd1958b..1fc8fba3 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementDomainSharedModule.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementDomainSharedModule.cs
@@ -23,14 +23,14 @@ namespace Lion.AbpPro.NotificationManagement
Configure(options =>
{
options.Resources
- .Add("en")
+ .Add(NotificationManagementConsts.DefaultCultureName)
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/NotificationManagement");
});
Configure(options =>
{
- options.MapCodeNamespace("NotificationManagement", typeof(NotificationManagementResource));
+ options.MapCodeNamespace(NotificationManagementConsts.NameSpace, typeof(NotificationManagementResource));
});
}
}
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementErrorCodes.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementErrorCodes.cs
index e70b6c6d..0ac823e0 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementErrorCodes.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/NotificationManagementErrorCodes.cs
@@ -2,6 +2,9 @@ namespace Lion.AbpPro.NotificationManagement
{
public static class NotificationManagementErrorCodes
{
- //Add your business exception error codes here...
+ public const string ReceiverNotNull =NotificationManagementConsts.NameSpace+ ":100001";
+ public const string MessageNotExist =NotificationManagementConsts.NameSpace+ ":100002";
+ public const string MessageTypeUnknown =NotificationManagementConsts.NameSpace+ ":100003";
+ public const string UserUnSubscription =NotificationManagementConsts.NameSpace+ ":100004";
}
}
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationManagementDomainException.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationManagementDomainException.cs
index 4b4fd22f..671ad3ea 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationManagementDomainException.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationManagementDomainException.cs
@@ -5,16 +5,17 @@ using Volo.Abp;
namespace Lion.AbpPro.NotificationManagement
{
- public class NotificationManagementDomainException : UserFriendlyException
+ public class NotificationManagementDomainException : BusinessException
{
- public NotificationManagementDomainException(string message, string code = null, string details = null,
- Exception innerException = null, LogLevel logLevel = LogLevel.Warning) : base(message, code, details,
- innerException, logLevel)
+ public NotificationManagementDomainException(string code = null, string message = null, string details = null, Exception innerException = null,
+ LogLevel logLevel = LogLevel.Warning) : base(code, message, details,
+ innerException,
+ logLevel
+ )
{
}
- public NotificationManagementDomainException(SerializationInfo serializationInfo, StreamingContext context) :
- base(serializationInfo, context)
+ public NotificationManagementDomainException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context)
{
}
}
diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
index 4239bff7..22a10b79 100644
--- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
+++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs
@@ -32,7 +32,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
{
if (receiveIds is {Count: 0})
{
- throw new NotificationManagementDomainException("消息接收人不能为空");
+ throw new NotificationManagementDomainException(NotificationManagementErrorCodes.ReceiverNotNull);
}
var senderId = Guid.Empty;
@@ -113,7 +113,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
public async Task SetReadAsync(Guid id, Guid receiveId)
{
var notification = await _notificationRepository.FindByIdAsync(id);
- if (notification == null) throw new NotificationManagementDomainException(message: "消息不存在");
+ if (notification == null) throw new NotificationManagementDomainException(NotificationManagementErrorCodes.MessageNotExist);
if (notification.MessageType == MessageType.BroadCast)
{
// 如果类型是广播消息,用户设置为已读,在插入一条数据
@@ -124,7 +124,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications
var notificationSubscription =
notification.NotificationSubscriptions.FirstOrDefault(e => e.ReceiveId == receiveId);
if (notificationSubscription == null)
- throw new NotificationManagementDomainException(message: "当前用户未订阅该消息");
+ throw new NotificationManagementDomainException(NotificationManagementErrorCodes.UserUnSubscription);
notificationSubscription.SetRead();
}
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
index e3259b75..c24cef6d 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
@@ -135,9 +135,6 @@ namespace Lion.AbpPro
///
private void ConfigureAbpExceptions(ServiceConfigurationContext context)
{
- //开启后通过ErrorCode抛本地化异常,message不会显示本地化词条
- var SendExceptionsDetails = context.Services.GetHostingEnvironment().IsDevelopment();
- context.Services.Configure(options => { options.SendExceptionsDetailsToClients = SendExceptionsDetails; });
context.Services.AddMvc(options => { options.Filters.Add(typeof(ResultExceptionFilter)); });
}
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Staging.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Staging.json
new file mode 100644
index 00000000..2b4e393d
--- /dev/null
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.Staging.json
@@ -0,0 +1,66 @@
+{
+ "App": {
+ "SelfUrl": "http://localhost:44315",
+ "CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:3100"
+ },
+ "ConnectionStrings": {
+ "Default": "Data Source=120.24.194.14;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
+ },
+ "Redis": {
+ "Configuration": "localhost,password=mypassword,defaultdatabase=1"
+ },
+ "Jwt": {
+ "Audience": "http://localhost:5010",
+ "SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=",
+ "Issuer": "YHWmsOperationApiGateway",
+ "ExpirationTime": 30
+ },
+ "Cap": {
+ "Enabled": "true",
+ "RabbitMq": {
+ "HostName": "localhost",
+ "UserName": "admin",
+ "Password": "admin"
+ }
+ },
+ "ElasticSearch": {
+ "Enabled": "false",
+ "Url": "http://es.cn",
+ "IndexFormat": "Lion.AbpPro.development.{0:yyyy.MM.dd}",
+ "UserName": "elastic",
+ "Password": "aVVhjQ95RP7nbwNy",
+ "SearchIndexFormat": "Lion.AbpPro.development*"
+ },
+ "HttpClient": {
+ "Sts": {
+ "Name": "Sts",
+ "Url": "http://localhost:44354"
+ },
+ "Github": {
+ "Name": "Github",
+ "Url": "https://github.com",
+ "ClientId": "127fc528f611879fba03",
+ "ClientSecret": "fd0914e9e8e28b51dd5efe381121429279e43973"
+ },
+ "GithubApi": {
+ "Name": "GithubApi",
+ "Url": "https://api.github.com",
+ "ClientName": "AbpPro"
+ }
+ },
+ "Consul": {
+ "Enabled": false,
+ "Host": "http://localhost:8500",
+ "Service": "Project-Service"
+ },
+ "AliYun": {
+ "OSS": {
+ "AccessKeyId": "LTAI5tLkt3vvScGPVZ5qKJDc1S",
+ "AccessKeySecret": "BixV8vP5uPrbsdwjYzzsEXOPjkxPST2S",
+ "Endpoint": "oss-cn-shenzhen.aliyuncs.com",
+ "ContainerName": "lion-abp-pro",
+ "RegionId": "oss-cn-shenzhen",
+ "RoleArn": "acs:ram::1846393972471789:role/ramosstestst"
+ }
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
index e8367f87..bb8f32cf 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
@@ -1,4 +1,5 @@
{
+ "Serilog1": "12",
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
@@ -12,7 +13,7 @@
"Hangfire": "Information",
"DotNetCore.CAP": "Information",
"Serilog.AspNetCore": "Information",
- "Microsoft.EntityFrameworkCore": "Information"
+ "Microsoft.EntityFrameworkCore": "Warning"
}
},
"WriteTo": [
@@ -33,7 +34,7 @@
"CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:3100"
},
"ConnectionStrings": {
- "Default": "Data Source=localhost;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
+ "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Redis": {
"Configuration": "localhost,password=mypassword,defaultdatabase=1"
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/AddRoleToOrganizationUnitInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/AddRoleToOrganizationUnitInput.cs
new file mode 100644
index 00000000..5499b839
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/AddRoleToOrganizationUnitInput.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class AddRoleToOrganizationUnitInput
+{
+ public List RoleId { get; set; }
+
+ public Guid OrganizationUnitId { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/AddUserToOrganizationUnitInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/AddUserToOrganizationUnitInput.cs
new file mode 100644
index 00000000..a7f7c6c9
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/AddUserToOrganizationUnitInput.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class AddUserToOrganizationUnitInput
+{
+ public List UserId { get; set; }
+
+ public Guid OrganizationUnitId { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/CreateOrganizationUnitInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/CreateOrganizationUnitInput.cs
new file mode 100644
index 00000000..d3707fa9
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/CreateOrganizationUnitInput.cs
@@ -0,0 +1,11 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class CreateOrganizationUnitInput
+{
+ [Required] public string DisplayName { get; set; }
+
+ public Guid? ParentId { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitRoleInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitRoleInput.cs
new file mode 100644
index 00000000..80376390
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitRoleInput.cs
@@ -0,0 +1,10 @@
+using System;
+using Lion.AbpPro.Extension.Customs.Dtos;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetOrganizationUnitRoleInput : PagingBase
+{
+ public Guid OrganizationUnitId { get; set; }
+
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitRoleOutput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitRoleOutput.cs
new file mode 100644
index 00000000..ce741503
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitRoleOutput.cs
@@ -0,0 +1,11 @@
+using System;
+using Lion.AbpPro.Extension.Customs.Dtos;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetOrganizationUnitRoleOutput
+{
+ public Guid Id { get; set; }
+
+ public string Name { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitUserInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitUserInput.cs
new file mode 100644
index 00000000..838dee23
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitUserInput.cs
@@ -0,0 +1,11 @@
+using System;
+using Lion.AbpPro.Extension.Customs.Dtos;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetOrganizationUnitUserInput : PagingBase
+{
+ public Guid OrganizationUnitId { get; set; }
+
+ public string Filter { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitUserOutput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitUserOutput.cs
new file mode 100644
index 00000000..7ca19109
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetOrganizationUnitUserOutput.cs
@@ -0,0 +1,13 @@
+using System;
+using Lion.AbpPro.Extension.Customs.Dtos;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetOrganizationUnitUserOutput
+{
+ public Guid Id { get; set; }
+
+ public string UserName { get; set; }
+
+ public string Email { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddRoleInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddRoleInput.cs
new file mode 100644
index 00000000..3c1e5c9c
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddRoleInput.cs
@@ -0,0 +1,11 @@
+using System;
+using Lion.AbpPro.Extension.Customs.Dtos;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetUnAddRoleInput : PagingBase
+{
+ public Guid OrganizationUnitId { get; set; }
+
+ public string Filter { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddRoleOutput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddRoleOutput.cs
new file mode 100644
index 00000000..7ecc5064
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddRoleOutput.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetUnAddRoleOutput
+{
+ public Guid Id { get; set; }
+
+ public string Name { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddUserInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddUserInput.cs
new file mode 100644
index 00000000..fd3ddf6a
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddUserInput.cs
@@ -0,0 +1,11 @@
+using System;
+using Lion.AbpPro.Extension.Customs.Dtos;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetUnAddUserInput : PagingBase
+{
+ public Guid OrganizationUnitId { get; set; }
+
+ public string Filter { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddUserOutput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddUserOutput.cs
new file mode 100644
index 00000000..075be06d
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/GetUnAddUserOutput.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class GetUnAddUserOutput
+{
+ public Guid Id { get; set; }
+
+ public string UserName { get; set; }
+
+ public string Email { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/OrganizationUnitDto.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/OrganizationUnitDto.cs
new file mode 100644
index 00000000..0d9c2cf9
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/OrganizationUnitDto.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class OrganizationUnitDto
+{
+ public Guid Id { get; set; }
+
+ public Guid? TenantId { get; set; }
+
+ public string Code { get; set; }
+
+ public string DisplayName { get; set; }
+
+ public Guid? ParentId { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/RemoveRoleToOrganizationUnitInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/RemoveRoleToOrganizationUnitInput.cs
new file mode 100644
index 00000000..fff35537
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/RemoveRoleToOrganizationUnitInput.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class RemoveRoleToOrganizationUnitInput
+{
+ public Guid RoleId { get; set; }
+
+ public Guid OrganizationUnitId { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/RemoveUserToOrganizationUnitInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/RemoveUserToOrganizationUnitInput.cs
new file mode 100644
index 00000000..19b5956d
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/RemoveUserToOrganizationUnitInput.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class RemoveUserToOrganizationUnitInput
+{
+ public Guid UserId { get; set; }
+
+ public Guid OrganizationUnitId { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/TreeOutput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/TreeOutput.cs
new file mode 100644
index 00000000..856144f3
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/TreeOutput.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class TreeOutput
+{
+ public string Title { get; set; }
+
+ public Guid Key { get; set; }
+
+ public List Children { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/UpdateOrganizationUnitInput.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/UpdateOrganizationUnitInput.cs
new file mode 100644
index 00000000..ae9e8ce3
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/Dto/UpdateOrganizationUnitInput.cs
@@ -0,0 +1,11 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+
+namespace Lion.AbpPro.OrganizationUnits.Dto;
+
+public class UpdateOrganizationUnitInput
+{
+ [Required] public string DisplayName { get; set; }
+
+ public Guid Id { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/IOrganizationUnitAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/IOrganizationUnitAppService.cs
new file mode 100644
index 00000000..badcf6e6
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/OrganizationUnits/IOrganizationUnitAppService.cs
@@ -0,0 +1,73 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Lion.AbpPro.Extension.Customs.Dtos;
+using Lion.AbpPro.OrganizationUnits.Dto;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Application.Services;
+
+namespace Lion.AbpPro.OrganizationUnits;
+
+public interface IOrganizationUnitAppService : IApplicationService
+{
+ ///
+ /// 获取组织机构树结构
+ ///
+ ///
+ Task> GetTreeAsync();
+
+ ///
+ /// 创建组织机构
+ ///
+ Task CreateAsync(CreateOrganizationUnitInput input);
+
+ ///
+ /// 删除组织机构
+ ///
+ Task DeleteAsync(IdInput input);
+
+ ///
+ /// 编辑组织机构
+ ///
+ Task UpdateAsync(UpdateOrganizationUnitInput input);
+
+ ///
+ /// 向组织机构添加角色
+ ///
+ Task AddRoleToOrganizationUnitAsync(AddRoleToOrganizationUnitInput input);
+
+ ///
+ /// 向组织机构删除角色
+ ///
+ Task RemoveRoleFromOrganizationUnitAsync(RemoveRoleToOrganizationUnitInput input);
+
+ ///
+ /// 向组织机构添加用户
+ ///
+ Task AddUserToOrganizationUnitAsync(AddUserToOrganizationUnitInput input);
+
+ ///
+ /// 向组织机构删除用户
+ ///
+ Task RemoveUserFromOrganizationUnitAsync(RemoveUserToOrganizationUnitInput input);
+
+ ///
+ /// 分页获取组织机构下用户
+ ///
+ Task> GetUsersAsync(GetOrganizationUnitUserInput input);
+
+
+ ///
+ /// 分页获取组织机构下角色
+ ///
+ Task> GetRolesAsync(GetOrganizationUnitRoleInput input);
+
+ ///
+ /// 获取不在组织机构的用户
+ ///
+ Task> GetUnAddUsersAsync(GetUnAddUserInput input);
+
+ ///
+ /// 获取不在组织机构的角色
+ ///
+ Task> GetUnAddRolessAsync(GetUnAddRoleInput input);
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissionDefinitionProvider.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissionDefinitionProvider.cs
index 756d17f6..a40863bc 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissionDefinitionProvider.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissionDefinitionProvider.cs
@@ -19,55 +19,141 @@ namespace Lion.AbpPro.Permissions
abpIdentityGroup.AddPermission(AbpProPermissions.SystemManagement.AuditLog, L("Permission:AuditLogManagement"));
var esManagement = abpIdentityGroup.AddPermission(AbpProPermissions.SystemManagement.ES, L("Permission:ESManagement"));
var settingManagement = abpIdentityGroup.AddPermission(AbpProPermissions.SystemManagement.Setting, L("Permission:SettingManagement"));
+ var organizationUnitManagement = abpIdentityGroup.AddPermission(AbpProPermissions.SystemManagement.OrganizationUnit, L("Permission:OrganizationUnitManagement"));
+ organizationUnitManagement.AddChild
+ (
+ AbpProPermissions.SystemManagement.OrganizationUnitManagement.Create,
+ L("Permission:Create")
+ );
+ organizationUnitManagement.AddChild
+ (
+ AbpProPermissions.SystemManagement.OrganizationUnitManagement.Update,
+ L("Permission:Update")
+ );
+ organizationUnitManagement.AddChild
+ (
+ AbpProPermissions.SystemManagement.OrganizationUnitManagement.Delete,
+ L("Permission:Delete")
+ );
#region IdentityServer
// multiTenancySide: MultiTenancySides.Host 只有host租户才有权限
var identityServerManagementGroup =
- context.AddGroup(AbpProPermissions.IdentityServer.IdentityServerManagement, L("Permission:IdentityServerManagement"),
- multiTenancySide: MultiTenancySides.Host);
+ context.AddGroup
+ (
+ AbpProPermissions.IdentityServer.IdentityServerManagement,
+ L("Permission:IdentityServerManagement"),
+ multiTenancySide: MultiTenancySides.Host
+ );
- var clientManagment = identityServerManagementGroup.AddPermission(AbpProPermissions.IdentityServer.Client.Default,
- L("Permission:IdentityServerManagement:Client"),multiTenancySide: MultiTenancySides.Host);
- clientManagment.AddChild(AbpProPermissions.IdentityServer.Client.Create,
- L("Permission:Create"),multiTenancySide: MultiTenancySides.Host);
- clientManagment.AddChild(AbpProPermissions.IdentityServer.Client.Update,
- L("Permission:Update"),multiTenancySide: MultiTenancySides.Host);
- clientManagment.AddChild(AbpProPermissions.IdentityServer.Client.Delete,
- L("Permission:Delete"),multiTenancySide: MultiTenancySides.Host);
- clientManagment.AddChild(AbpProPermissions.IdentityServer.Client.Enable,
- L("Permission:Enable"),multiTenancySide: MultiTenancySides.Host);
+ var clientManagment = identityServerManagementGroup.AddPermission
+ (
+ AbpProPermissions.IdentityServer.Client.Default,
+ L("Permission:IdentityServerManagement:Client"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ clientManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.Client.Create,
+ L("Permission:Create"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ clientManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.Client.Update,
+ L("Permission:Update"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ clientManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.Client.Delete,
+ L("Permission:Delete"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ clientManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.Client.Enable,
+ L("Permission:Enable"),
+ multiTenancySide: MultiTenancySides.Host
+ );
- var apiResourceManagment = identityServerManagementGroup.AddPermission(
+ var apiResourceManagment = identityServerManagementGroup.AddPermission
+ (
AbpProPermissions.IdentityServer.ApiResource.Default,
- L("Permission:IdentityServerManagement:ApiResource"),multiTenancySide: MultiTenancySides.Host);
- apiResourceManagment.AddChild(AbpProPermissions.IdentityServer.ApiResource.Create,
- L("Permission:Create"),multiTenancySide: MultiTenancySides.Host);
- apiResourceManagment.AddChild(AbpProPermissions.IdentityServer.ApiResource.Update,
- L("Permission:Update"),multiTenancySide: MultiTenancySides.Host);
- apiResourceManagment.AddChild(AbpProPermissions.IdentityServer.ApiResource.Delete,
- L("Permission:Delete"),multiTenancySide: MultiTenancySides.Host);
+ L("Permission:IdentityServerManagement:ApiResource"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ apiResourceManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.ApiResource.Create,
+ L("Permission:Create"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ apiResourceManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.ApiResource.Update,
+ L("Permission:Update"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ apiResourceManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.ApiResource.Delete,
+ L("Permission:Delete"),
+ multiTenancySide: MultiTenancySides.Host
+ );
- var apiScopeManagment = identityServerManagementGroup.AddPermission(AbpProPermissions.IdentityServer.ApiScope.Default,
- L("Permission:IdentityServerManagement:ApiScope"),multiTenancySide: MultiTenancySides.Host);
- apiScopeManagment.AddChild(AbpProPermissions.IdentityServer.ApiScope.Create,
- L("Permission:Create"),multiTenancySide: MultiTenancySides.Host);
- apiScopeManagment.AddChild(AbpProPermissions.IdentityServer.ApiScope.Update,
- L("Permission:Update"),multiTenancySide: MultiTenancySides.Host);
- apiScopeManagment.AddChild(AbpProPermissions.IdentityServer.ApiScope.Delete,
- L("Permission:Delete"),multiTenancySide: MultiTenancySides.Host);
+ var apiScopeManagment = identityServerManagementGroup.AddPermission
+ (
+ AbpProPermissions.IdentityServer.ApiScope.Default,
+ L("Permission:IdentityServerManagement:ApiScope"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ apiScopeManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.ApiScope.Create,
+ L("Permission:Create"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ apiScopeManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.ApiScope.Update,
+ L("Permission:Update"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ apiScopeManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.ApiScope.Delete,
+ L("Permission:Delete"),
+ multiTenancySide: MultiTenancySides.Host
+ );
- var identityResourcesManagment = identityServerManagementGroup.AddPermission(
+ var identityResourcesManagment = identityServerManagementGroup.AddPermission
+ (
AbpProPermissions.IdentityServer.IdentityResources.Default,
- L("Permission:IdentityServerManagement:IdentityResources"),multiTenancySide: MultiTenancySides.Host);
- identityResourcesManagment.AddChild(AbpProPermissions.IdentityServer.IdentityResources.Create,
- L("Permission:Create"),multiTenancySide: MultiTenancySides.Host);
- identityResourcesManagment.AddChild(AbpProPermissions.IdentityServer.IdentityResources.Update,
- L("Permission:Update"),multiTenancySide: MultiTenancySides.Host);
- identityResourcesManagment.AddChild(AbpProPermissions.IdentityServer.IdentityResources.Delete,
- L("Permission:Delete"),multiTenancySide: MultiTenancySides.Host);
+ L("Permission:IdentityServerManagement:IdentityResources"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ identityResourcesManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.IdentityResources.Create,
+ L("Permission:Create"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ identityResourcesManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.IdentityResources.Update,
+ L("Permission:Update"),
+ multiTenancySide: MultiTenancySides.Host
+ );
+ identityResourcesManagment.AddChild
+ (
+ AbpProPermissions.IdentityServer.IdentityResources.Delete,
+ L("Permission:Delete"),
+ multiTenancySide: MultiTenancySides.Host
+ );
#endregion
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissions.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissions.cs
index 7ef55704..2c873c8a 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissions.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Permissions/AbpProPermissions.cs
@@ -15,6 +15,14 @@ namespace Lion.AbpPro.Permissions
public const string AuditLog = Default + ".AuditLog";
public const string ES = Default + ".ES";
public const string Setting = Default + ".Setting";
+ public const string OrganizationUnit = Default + ".OrganizationUnitManagement";
+ public static class OrganizationUnitManagement
+ {
+ public const string Default = SystemManagement.Default + ".OrganizationUnitManagement";
+ public const string Create = Default + ".Create";
+ public const string Update = Default + ".Update";
+ public const string Delete = Default + ".Delete";
+ }
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationAutoMapperProfile.cs b/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationAutoMapperProfile.cs
index c9dd574e..d8964450 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationAutoMapperProfile.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationAutoMapperProfile.cs
@@ -1,4 +1,5 @@
using AutoMapper;
+using Lion.AbpPro.OrganizationUnits.Dto;
using Lion.AbpPro.Users.Dtos;
using Volo.Abp.Identity;
@@ -14,6 +15,11 @@ namespace Lion.AbpPro
CreateMap()
.ForMember(e => e.CreationTimeFormat, opt => opt.Ignore())
.ForMember(e => e.Status, opt => opt.Ignore());
+ CreateMap();
+ CreateMap();
+ CreateMap();
+ CreateMap();
+ CreateMap();
}
}
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/ElasticSearchs/LionAbpProLogAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application/ElasticSearchs/LionAbpProLogAppService.cs
index 8d143f51..08b44e16 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application/ElasticSearchs/LionAbpProLogAppService.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application/ElasticSearchs/LionAbpProLogAppService.cs
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Lion.AbpPro.ElasticSearchs.Dto;
using Lion.AbpPro.ElasticSearchs.Providers;
using Lion.AbpPro.Extension.Customs.Dtos;
+using Lion.AbpPro.Extension.System;
using Lion.AbpPro.Permissions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Configuration;
@@ -13,11 +14,11 @@ using Nest;
namespace Lion.AbpPro.ElasticSearchs
{
[Authorize(Policy = AbpProPermissions.SystemManagement.ES)]
- public class LionAbpProLogAppService : ElasticsearchBasicService,
- ILionAbpProLogAppService
+ public class LionAbpProLogAppService : ElasticsearchBasicService,ILionAbpProLogAppService
{
private readonly IConfiguration _configuration;
-
+ // 时区
+ private const string TimeZone = "Asia/Shanghai";
public LionAbpProLogAppService(
IElasticsearchProvider elasticsearchProvider,
IConfiguration configuration) : base(elasticsearchProvider)
@@ -25,49 +26,54 @@ namespace Lion.AbpPro.ElasticSearchs
_configuration = configuration;
}
- public async Task> PaingAsync(
- PagingElasticSearchLogInput input)
+ public async Task> PaingAsync(PagingElasticSearchLogInput input)
{
- var IndexName =
- _configuration.GetValue("ElasticSearch:SearchIndexFormat");
+ var IndexName = _configuration.GetValue("ElasticSearch:SearchIndexFormat");
// 默认查询当天
- input.StartCreationTime = input.StartCreationTime?.AddMilliseconds(-1) ??
- DateTime.Now.Date.AddMilliseconds(-1);
- input.EndCreationTime =
- input.EndCreationTime?.AddDays(1).AddMilliseconds(-1) ??
- DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
- var mustFilters =
- new List,
- QueryContainer>>
- {
- t => t.DateRange(f =>
- f.Field(fd => fd.CreationTime).TimeZone("Asia/Shanghai")
- .GreaterThanOrEquals(input.StartCreationTime.Value)),
- t => t.DateRange(
- f => f.Field(fd => fd.CreationTime).TimeZone("Asia/Shanghai")
- .LessThanOrEquals(input.EndCreationTime.Value))
- };
+ input.StartCreationTime = input.StartCreationTime?.AddMilliseconds(-1) ??DateTime.Now.Date.AddMilliseconds(-1);
+ input.EndCreationTime =input.EndCreationTime?.AddDays(1).AddMilliseconds(-1) ??DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
+ var mustFilters = new List, QueryContainer>>();
+ if (input.StartCreationTime.HasValue)
+ {
+ input.StartCreationTime = input.StartCreationTime.ToCurrentDateMaxDateTime();
+ mustFilters.Add(e => e.DateRange(f => f.Field(fd => fd.CreationTime).TimeZone(TimeZone).GreaterThanOrEquals(input.StartCreationTime)));
+ }
+
+ if (input.EndCreationTime.HasValue)
+ {
+ input.EndCreationTime = input.EndCreationTime.ToNextSecondDateTime();
+ mustFilters.Add(e => e.DateRange(f => f.Field(fd => fd.CreationTime).TimeZone(TimeZone).LessThanOrEquals(input.EndCreationTime)));
+ }
if (!string.IsNullOrWhiteSpace(input.Filter))
{
- mustFilters.Add(t =>
- t.MatchPhrase(f => f.Field(fd => fd.Message).Query(input.Filter.Trim())));
+ mustFilters.Add
+ (
+ t =>t.MatchPhrase(f => f.Field(fd => fd.Message).Query(input.Filter.Trim()))
+ );
}
- var result = await Client.SearchAsync(e => e
- .Index(IndexName)
- .From(input.SkipCount)
- .Size(input.PageSize)
- .Sort(s => s.Descending(sd => sd.CreationTime))
- .Query(q => q.Bool(qb => qb.Filter(mustFilters))));
+ var result = await Client.SearchAsync
+ (
+ e => e
+ .Index(IndexName)
+ .From(input.SkipCount)
+ .Size(input.PageSize)
+ .Sort(s => s.Descending(sd => sd.CreationTime))
+ .Query(q => q.Bool(qb => qb.Filter(mustFilters)))
+ );
if (result.HitsMetadata != null)
{
- return new CustomePagedResultDto(
+ return new CustomePagedResultDto
+ (
result.HitsMetadata.Total.Value,
ObjectMapper
- .Map, List>(
- result.Documents.ToList()));
+ .Map, List>
+ (
+ result.Documents.ToList()
+ )
+ );
}
return null;
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/OrganizationUnits/OrganizationUnitAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application/OrganizationUnits/OrganizationUnitAppService.cs
new file mode 100644
index 00000000..56f4bc33
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Application/OrganizationUnits/OrganizationUnitAppService.cs
@@ -0,0 +1,210 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Lion.AbpPro.Extension.Customs.Dtos;
+using Lion.AbpPro.OrganizationUnits.Dto;
+using Lion.AbpPro.Permissions;
+using Microsoft.AspNetCore.Authorization;
+using Volo.Abp;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Identity;
+
+namespace Lion.AbpPro.OrganizationUnits;
+
+[Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Default)]
+public class OrganizationUnitAppService : AbpProAppService, IOrganizationUnitAppService
+{
+ private readonly OrganizationUnitManager _organizationUnitManager;
+ private readonly IdentityUserManager _identityUserManager;
+ private readonly IOrganizationUnitRepository _organizationUnitRepository;
+
+ public OrganizationUnitAppService(
+ OrganizationUnitManager OrganizationUnitManager,
+ IdentityUserManager identityUserManager,
+ IOrganizationUnitRepository organizationUnitRepository)
+ {
+ _organizationUnitManager = OrganizationUnitManager;
+ _identityUserManager = identityUserManager;
+ _organizationUnitRepository = organizationUnitRepository;
+ }
+
+ public async Task> GetTreeAsync()
+ {
+ var organizationUnits = await _organizationUnitRepository.GetListAsync();
+ var organizationUnitDtos = ObjectMapper.Map, List>(organizationUnits);
+ return ConvertToTree(organizationUnitDtos);
+ }
+
+ [Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Create)]
+ public async Task CreateAsync(CreateOrganizationUnitInput input)
+ {
+ var entity = new OrganizationUnit
+ (
+ GuidGenerator.Create(),
+ input.DisplayName,
+ input.ParentId,
+ CurrentTenant.Id
+ );
+ await _organizationUnitManager.CreateAsync(entity);
+ }
+
+ [Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Delete)]
+ public Task DeleteAsync(IdInput input)
+ {
+ return _organizationUnitManager.DeleteAsync(input.Id);
+ }
+
+ [Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Update)]
+ public async Task UpdateAsync(UpdateOrganizationUnitInput input)
+ {
+ var entity = await _organizationUnitRepository.FindAsync(input.Id);
+ if (entity != null)
+ {
+ entity.DisplayName = input.DisplayName;
+ await _organizationUnitManager.UpdateAsync(entity);
+ }
+ }
+
+ [Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Create)]
+ public async Task AddRoleToOrganizationUnitAsync(AddRoleToOrganizationUnitInput input)
+ {
+ foreach (var roleId in input.RoleId)
+ {
+ await _organizationUnitManager.AddRoleToOrganizationUnitAsync(roleId, input.OrganizationUnitId);
+ }
+ }
+
+ [Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Delete)]
+ public async Task RemoveRoleFromOrganizationUnitAsync(RemoveRoleToOrganizationUnitInput input)
+ {
+ await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(input.RoleId, input.OrganizationUnitId);
+ }
+
+ [Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Create)]
+ public async Task AddUserToOrganizationUnitAsync(AddUserToOrganizationUnitInput input)
+ {
+ foreach (var userId in input.UserId)
+ {
+ await _identityUserManager.AddToOrganizationUnitAsync(userId, input.OrganizationUnitId);
+ }
+ }
+
+ [Authorize(AbpProPermissions.SystemManagement.OrganizationUnitManagement.Delete)]
+ public async Task RemoveUserFromOrganizationUnitAsync(RemoveUserToOrganizationUnitInput input)
+ {
+ await _identityUserManager.RemoveFromOrganizationUnitAsync(input.UserId, input.OrganizationUnitId);
+ }
+
+ public async Task> GetUsersAsync(GetOrganizationUnitUserInput input)
+ {
+ var listResult = new List();
+ var organizationUnit = await _organizationUnitRepository.FindAsync(input.OrganizationUnitId);
+ if (organizationUnit == null) throw new BusinessException(AbpProDomainErrorCodes.OrganizationUnitNotExist);
+
+ var count = await _organizationUnitRepository.GetMembersCountAsync(organizationUnit, filter: input.Filter);
+ if (count > 0)
+ {
+ var list = await _organizationUnitRepository.GetMembersAsync
+ (
+ organizationUnit,
+ maxResultCount: input.PageSize,
+ skipCount: input.SkipCount,
+ filter: input.Filter
+ );
+ listResult = ObjectMapper.Map, List>(list);
+ }
+
+ return new PagedResultDto(count, listResult);
+ }
+
+ public async Task> GetUnAddUsersAsync(GetUnAddUserInput input)
+ {
+ var listResult = new List();
+ var organizationUnit = await _organizationUnitRepository.FindAsync(input.OrganizationUnitId);
+ if (organizationUnit == null) throw new BusinessException(AbpProDomainErrorCodes.OrganizationUnitNotExist);
+ var count = await _organizationUnitRepository.GetUnaddedUsersCountAsync(organizationUnit, input.Filter);
+ if (count > 0)
+ {
+ var users = await _organizationUnitRepository.GetUnaddedUsersAsync
+ (
+ organizationUnit,
+ maxResultCount: input.PageSize,
+ skipCount: input.SkipCount,
+ filter: input.Filter
+ );
+ listResult = ObjectMapper.Map, List>(users);
+ }
+
+ return new PagedResultDto(count, listResult);
+ }
+
+ public async Task> GetRolesAsync(GetOrganizationUnitRoleInput input)
+ {
+ var listResult = new List();
+ var organizationUnit = await _organizationUnitRepository.FindAsync(input.OrganizationUnitId);
+ if (organizationUnit == null) throw new BusinessException(AbpProDomainErrorCodes.OrganizationUnitNotExist);
+
+ var count = await _organizationUnitRepository.GetRolesCountAsync(organizationUnit);
+ if (count > 0)
+ {
+ var list = await _organizationUnitRepository.GetRolesAsync(organizationUnit, maxResultCount: input.PageSize, skipCount: input.SkipCount);
+ listResult = ObjectMapper.Map, List>(list);
+ }
+
+ return new PagedResultDto(count, listResult);
+ }
+
+ public async Task> GetUnAddRolessAsync(GetUnAddRoleInput input)
+ {
+ var listResult = new List();
+ var organizationUnit = await _organizationUnitRepository.FindAsync(input.OrganizationUnitId);
+ if (organizationUnit == null) throw new BusinessException(AbpProDomainErrorCodes.OrganizationUnitNotExist);
+ var count = await _organizationUnitRepository.GetUnaddedRolesCountAsync(organizationUnit, input.Filter);
+ if (count > 0)
+ {
+ var roles = await _organizationUnitRepository.GetUnaddedRolesAsync
+ (
+ organizationUnit,
+ maxResultCount: input.PageSize,
+ skipCount: input.SkipCount,
+ filter: input.Filter
+ );
+ listResult = ObjectMapper.Map, List>(roles);
+ }
+
+ return new PagedResultDto(count, listResult);
+ }
+
+ #region 私有方法
+
+ private List ConvertToTree(
+ List list,
+ Guid? Id = null)
+ {
+ var result = new List();
+ var childList = Children(list, Id);
+ foreach (var item in childList)
+ {
+ var tree = new TreeOutput
+ {
+ Key = item.Id,
+ Title = item.DisplayName,
+ Children = ConvertToTree(list, item.Id)
+ };
+ result.Add(tree);
+ }
+
+ return result;
+ }
+
+ private List Children(
+ List list,
+ Guid? Id)
+ {
+ var childList = list.Where(x => x.ParentId == Id).ToList();
+ return childList;
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Users/AccountAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application/Users/AccountAppService.cs
index 464f5dda..d7c448aa 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application/Users/AccountAppService.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application/Users/AccountAppService.cs
@@ -10,10 +10,12 @@ using Lion.AbpPro.ConfigurationOptions;
using Lion.AbpPro.Users.Dtos;
using IdentityModel;
using Lion.AbpPro.Extension.Customs.Http;
+using Lion.AbpPro.NotificationManagement.Notifications;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using Volo.Abp;
+using Volo.Abp.Authorization;
using Volo.Abp.Identity;
using Volo.Abp.Security.Claims;
@@ -27,9 +29,8 @@ namespace Lion.AbpPro.Users
private readonly Microsoft.AspNetCore.Identity.SignInManager _signInManager;
private readonly IHttpClientFactory _httpClientFactory;
private readonly IConfiguration _configuretion;
-
private readonly Volo.Abp.Domain.Repositories.IRepository _identityRoleRepository;
-
+
public AccountAppService(
IdentityUserManager userManager,
IOptionsSnapshot jwtOptions,
@@ -52,12 +53,12 @@ namespace Lion.AbpPro.Users
var result = await _signInManager.PasswordSignInAsync(input.Name, input.Password, false, true);
if (result.IsNotAllowed)
{
- throw new UserFriendlyException("当前用户已锁定");
+ throw new BusinessException(AbpProDomainErrorCodes.UserLockedOut);
}
if (!result.Succeeded)
{
- throw new UserFriendlyException("用户名或者密码错误");
+ throw new BusinessException(AbpProDomainErrorCodes.UserOrPasswordMismatch);
}
var user = await _userManager.FindByNameAsync(input.Name);
@@ -77,7 +78,7 @@ namespace Lion.AbpPro.Users
var user = await _userManager.FindByNameAsync(response.name);
if (!user.IsActive)
{
- throw new UserFriendlyException("当前用户已锁定");
+ throw new BusinessException(AbpProDomainErrorCodes.UserLockedOut);
}
return await BuildResult(user);
@@ -116,7 +117,7 @@ namespace Lion.AbpPro.Users
{
var result = new LoginOutput();
var roles = await _identityRoleRepository.GetListAsync(e => e.IsDefault);
- if (roles == null || roles.Count == 0) throw new UserFriendlyException("系统未配置默认角色");
+ if (roles == null || roles.Count == 0) throw new AbpAuthorizationException();
var userId = GuidGenerator.Create();
var user = new IdentityUser(userId, userName, email)
@@ -139,9 +140,9 @@ namespace Lion.AbpPro.Users
private async Task BuildResult(IdentityUser user)
{
- if (!user.IsActive) throw new UserFriendlyException("当前用户已被锁定");
+ if (!user.IsActive) throw new BusinessException(AbpProDomainErrorCodes.UserLockedOut);
var roles = await _userManager.GetRolesAsync(user);
- if (roles == null || roles.Count == 0) throw new UserFriendlyException("当前用户未分配角色");
+ if (roles == null || roles.Count == 0) throw new AbpAuthorizationException();
var token = GenerateJwt(user.Id, user.UserName, user.Name, user.Email,
user.TenantId.ToString(), roles.ToList());
var loginOutput = ObjectMapper.Map(user);
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs
index 3125eb4f..bcee144c 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Lion.AbpPro.Users.Dtos;
using Lion.AbpPro.Extension.Customs.Dtos;
+using Lion.AbpPro.NotificationManagement.Notifications;
using Lion.AbpPro.Permissions;
using Magicodes.ExporterAndImporter.Excel;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
@@ -27,13 +28,13 @@ namespace Lion.AbpPro.Users
private readonly IIdentityUserRepository _identityUserRepository;
private readonly IExcelExporter _excelExporter;
private readonly IOptions _options;
-
public UserAppService(
IIdentityUserAppService identityUserAppService,
IdentityUserManager userManager,
IIdentityUserRepository userRepository,
IExcelExporter excelExporter,
- IOptions options)
+ IOptions options,
+ NotificationManager notificationManager)
{
_identityUserAppService = identityUserAppService;
_userManager = userManager;
diff --git a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/DbMigratorHostedService.cs b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/DbMigratorHostedService.cs
index 38f9c105..689ff0e0 100644
--- a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/DbMigratorHostedService.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/DbMigratorHostedService.cs
@@ -1,8 +1,10 @@
+using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Lion.AbpPro.Data;
+using Microsoft.Extensions.Configuration;
using Serilog;
using Volo.Abp;
@@ -11,28 +13,31 @@ namespace Lion.AbpPro.DbMigrator
public class DbMigratorHostedService : IHostedService
{
private readonly IHostApplicationLifetime _hostApplicationLifetime;
-
- public DbMigratorHostedService(IHostApplicationLifetime hostApplicationLifetime)
+ private readonly IConfiguration _configuration;
+ public DbMigratorHostedService(IHostApplicationLifetime hostApplicationLifetime,
+ IConfiguration configuration)
{
_hostApplicationLifetime = hostApplicationLifetime;
+ _configuration = configuration;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
- using (var application = AbpApplicationFactory.Create(options =>
- {
- options.UseAutofac();
- options.Services.AddLogging(c => c.AddSerilog());
- }))
+ using (var application = await AbpApplicationFactory.CreateAsync(options =>
+ {
+ options.Services.ReplaceConfiguration(_configuration);
+ options.UseAutofac();
+ options.Services.AddLogging(c => c.AddSerilog());
+ }))
{
- application.Initialize();
+ await application.InitializeAsync();
await application
.ServiceProvider
.GetRequiredService()
.MigrateAsync();
- application.Shutdown();
+ await application.ShutdownAsync();
_hostApplicationLifetime.StopApplication();
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Lion.AbpPro.DbMigrator.csproj b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Lion.AbpPro.DbMigrator.csproj
index 134e29d2..2d02cec6 100644
--- a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Lion.AbpPro.DbMigrator.csproj
+++ b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Lion.AbpPro.DbMigrator.csproj
@@ -7,17 +7,6 @@
net6.0
-
-
-
-
-
-
- PreserveNewest
- Always
-
-
-
@@ -37,6 +26,9 @@
+
+ Always
+
diff --git a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Program.cs b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Program.cs
index 7534d956..d150c21b 100644
--- a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Program.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/Program.cs
@@ -1,5 +1,7 @@
+using System;
using System.IO;
using System.Threading.Tasks;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
diff --git a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json
index 738a223d..e711c4f8 100644
--- a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json
+++ b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
- "Default": "Data Source=localhost;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
+ "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
}
}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainErrorCodes.cs b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainErrorCodes.cs
index 0cbc67aa..4c1890f9 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainErrorCodes.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainErrorCodes.cs
@@ -2,6 +2,16 @@ namespace Lion.AbpPro
{
public static class AbpProDomainErrorCodes
{
- /* You can add your business exception error codes here, as constants */
+ public const string OrganizationUnitNotExist =AbpProDomainSharedConsts.NameSpace+ ":100001";
+ public const string UserLockedOut =AbpProDomainSharedConsts.NameSpace+ ":100002";
+ public const string UserOrPasswordMismatch =AbpProDomainSharedConsts.NameSpace+ ":100003";
+ public const string ApiResourceNotExist =AbpProDomainSharedConsts.NameSpace+ ":100004";
+ public const string ApiResourceExist =AbpProDomainSharedConsts.NameSpace+ ":100005";
+ public const string ApiScopeNotExist =AbpProDomainSharedConsts.NameSpace+ ":100006";
+ public const string ApiScopeExist =AbpProDomainSharedConsts.NameSpace+ ":100007";
+ public const string ApiClientNotExist =AbpProDomainSharedConsts.NameSpace+ ":100008";
+ public const string ApiClientExist =AbpProDomainSharedConsts.NameSpace+ ":100009";
+ public const string IdentityResourceNotExist =AbpProDomainSharedConsts.NameSpace+ ":100010";
+ public const string IdentityResourceExist =AbpProDomainSharedConsts.NameSpace+ ":100011";
}
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedConsts.cs b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedConsts.cs
new file mode 100644
index 00000000..7d139a66
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedConsts.cs
@@ -0,0 +1,9 @@
+namespace Lion.AbpPro;
+
+public class AbpProDomainSharedConsts
+{
+ /// 名称空间
+ public const string NameSpace = "Lion.AbpPro";
+ /// 默认语言
+ public const string DefaultCultureName = "zh-Hans";
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs
index 42ae4d33..be744054 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs
@@ -51,13 +51,13 @@ namespace Lion.AbpPro
{
Configure(options =>
{
- options.FileSets.AddEmbedded("Lion.AbpPro");
+ options.FileSets.AddEmbedded(AbpProDomainSharedConsts.NameSpace);
});
Configure(options =>
{
options.Resources
- .Add("zh-Hans")
+ .Add(AbpProDomainSharedConsts.DefaultCultureName)
.AddVirtualJson("/Localization/AbpPro")
.AddBaseTypes(typeof(IdentityResource))
.AddBaseTypes(typeof(AbpValidationResource))
@@ -70,7 +70,7 @@ namespace Lion.AbpPro
Configure(options =>
{
- options.MapCodeNamespace("AbpPro", typeof(AbpProResource));
+ options.MapCodeNamespace(AbpProDomainSharedConsts.NameSpace, typeof(AbpProResource));
});
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json
index 4805147c..0adde08d 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json
@@ -17,6 +17,7 @@
"Permission:CapManagement": "IntegratedEvent",
"Permission:ESManagement": "ESManagement",
"Permission:SettingManagement": "SettingManagement",
+ "Permission:OrganizationUnitManagement": "OrganizationUnitManagement",
"Permission:IdentityServerManagement": "IdentityServer",
"Permission:IdentityServerManagement:Client": "Client",
"Permission:IdentityServerManagement:ApiResource": "ApiResource",
@@ -28,6 +29,19 @@
"Description:Setting.Group.Other.Github": "Github",
"Enum:TestType:Created:1":"Created",
"Enum:TestType:Cancel:1":"Cancel",
- "Enum:TestType:Delete:1":"Delete"
+ "Enum:TestType:Delete:1":"Delete",
+
+ "Lion.AbpPro:100001": "OrganizationUnit Not Exist",
+ "Lion.AbpPro:100002": "UserLockedOut",
+ "Lion.AbpPro:100003": "UserOrPasswordMismatch",
+ "Lion.AbpPro:100004": "ApiResource Not Exist",
+ "Lion.AbpPro:100005": "ApiResource Exist",
+ "Lion.AbpPro:100006": "ApiScope Not Exist",
+ "Lion.AbpPro:100007": "ApiScope Exist",
+ "Lion.AbpPro:100008": "ApiClient Not Exist",
+ "Lion.AbpPro:100009": "ApiClient Exist",
+ "Lion.AbpPro:100010": "IdentityResource Not Exist",
+ "Lion.AbpPro:100011": "IdentityResource Exist"
+
}
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json
index cf7cc496..86321fcd 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json
@@ -17,6 +17,7 @@
"Permission:CapManagement": "集成事件",
"Permission:ESManagement": "ES日志",
"Permission:SettingManagement": "设置管理",
+ "Permission:OrganizationUnitManagement": "组织结构管理",
"Permission:IdentityServerManagement": "IdentityServer",
"Permission:IdentityServerManagement:Client": "客户端",
"Permission:IdentityServerManagement:ApiResource": "Api资源",
@@ -28,6 +29,18 @@
"Description:Setting.Group.Other.Github": "Github",
"Enum:TestType:Created:1":"创建",
"Enum:TestType:Cancel:1":"取消",
- "Enum:TestType:Delete:1":"删除"
+ "Enum:TestType:Delete:1":"删除",
+
+ "Lion.AbpPro:100001": "组织机构不存在",
+ "Lion.AbpPro:100002": "用户被锁定",
+ "Lion.AbpPro:100003": "用户名或者密码错误",
+ "Lion.AbpPro:100004": "ApiResource不存在",
+ "Lion.AbpPro:100005": "ApiResource 已存在",
+ "Lion.AbpPro:100006": "ApiScope 不存在",
+ "Lion.AbpPro:100007": "ApiScope 已存在",
+ "Lion.AbpPro:100008": "ApiClient 不存在",
+ "Lion.AbpPro:100009": "ApiClient 已存在",
+ "Lion.AbpPro:100010": "IdentityResource 不存在",
+ "Lion.AbpPro:100011": "IdentityResource 已存在"
}
}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpProResource.cs b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpProResource.cs
index 5b29cf44..3f420a8b 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpProResource.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpProResource.cs
@@ -1,6 +1,6 @@
using Volo.Abp.Localization;
-namespace Lion.AbpPro.Localization
+namespace Lion.AbpPro
{
[LocalizationResourceName("AbpPro")]
public class AbpProResource
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs b/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs
index 0431b72e..c873c159 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs
@@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
using Lion.AbpPro.MultiTenancy;
using Lion.AbpPro.NotificationManagement;
using Volo.Abp.AuditLogging;
+using Volo.Abp.AutoMapper;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Emailing;
using Volo.Abp.FeatureManagement;
@@ -43,7 +44,10 @@ namespace Lion.AbpPro
{
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
-
+ Configure(options =>
+ {
+ options.AddMaps();
+ });
#if DEBUG
context.Services.Replace(ServiceDescriptor.Singleton());
#endif
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiResourceManager.cs b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiResourceManager.cs
index a0f3609c..04a548ed 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiResourceManager.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiResourceManager.cs
@@ -26,17 +26,26 @@ namespace Lion.AbpPro.IdentityServer
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
- return _apiResourceRepository.GetListAsync("CreationTime desc", skipCount,
- maxResultCount, filter,
+ return _apiResourceRepository.GetListAsync
+ (
+ "CreationTime desc",
+ skipCount,
+ maxResultCount,
+ filter,
includeDetails,
- cancellationToken);
+ cancellationToken
+ );
}
- public Task GetCountAsync(string filter = null,
+ public Task GetCountAsync(
+ string filter = null,
CancellationToken cancellationToken = default)
{
- return _apiResourceRepository.GetCountAsync(filter,
- cancellationToken);
+ return _apiResourceRepository.GetCountAsync
+ (
+ filter,
+ cancellationToken
+ );
}
///
@@ -65,10 +74,16 @@ namespace Lion.AbpPro.IdentityServer
await _apiResourceRepository.FindByNameAsync(name.Trim(), false, cancellationToken);
if (null != apiResource)
{
- throw new UserFriendlyException(message: "ApiResource已存在");
+ throw new BusinessException(AbpProDomainErrorCodes.ApiResourceExist);
}
- apiResource = new ApiResource(id, name, displayName, description)
+ apiResource = new ApiResource
+ (
+ id,
+ name,
+ displayName,
+ description
+ )
{
AllowedAccessTokenSigningAlgorithms = allowedAccessTokenSigningAlgorithms,
ShowInDiscoveryDocument = showInDiscoveryDocument,
@@ -83,8 +98,11 @@ namespace Lion.AbpPro.IdentityServer
//
// properties?.Distinct().ToList().ForEach(item => { apiResource.AddProperty(item.Key, item.Value); });
- return await _apiResourceRepository.InsertAsync(apiResource,
- cancellationToken: cancellationToken);
+ return await _apiResourceRepository.InsertAsync
+ (
+ apiResource,
+ cancellationToken: cancellationToken
+ );
}
public async Task DeleteAsync(
@@ -104,14 +122,13 @@ namespace Lion.AbpPro.IdentityServer
bool showInDiscoveryDocument,
string secret,
List scopes,
- CancellationToken cancellationToken = default
- )
+ CancellationToken cancellationToken = default)
{
var apiResource =
await _apiResourceRepository.FindByNameAsync(name.Trim(), true, cancellationToken);
if (null == apiResource)
{
- throw new UserFriendlyException(message: "ApiResource不存在");
+ throw new BusinessException(AbpProDomainErrorCodes.ApiResourceNotExist);
}
apiResource.DisplayName = displayName;
@@ -148,8 +165,11 @@ namespace Lion.AbpPro.IdentityServer
}
- return await _apiResourceRepository.UpdateAsync(apiResource,
- cancellationToken: cancellationToken);
+ return await _apiResourceRepository.UpdateAsync
+ (
+ apiResource,
+ cancellationToken: cancellationToken
+ );
}
}
}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiScopeManager.cs b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiScopeManager.cs
index 37c77b36..082c2712 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiScopeManager.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerApiScopeManager.cs
@@ -23,16 +23,19 @@ namespace Lion.AbpPro.IdentityServer
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
- return _apiScopeRepository.GetListAsync(
+ return _apiScopeRepository.GetListAsync
+ (
"CreationTime desc",
skipCount,
maxResultCount,
filter,
includeDetails,
- cancellationToken);
+ cancellationToken
+ );
}
- public Task GetCountAsync(string filter = null,
+ public Task GetCountAsync(
+ string filter = null,
CancellationToken cancellationToken = default)
{
return _apiScopeRepository.GetCountAsync(filter, cancellationToken);
@@ -48,11 +51,19 @@ namespace Lion.AbpPro.IdentityServer
bool showInDiscoveryDocument)
{
var apiScopes = await _apiScopeRepository.GetListByNameAsync(new[] { name }, false);
- if (apiScopes.Count > 0) throw new UserFriendlyException(message: $"{name}已存在");
+ if (apiScopes.Count > 0) throw new BusinessException(AbpProDomainErrorCodes.ApiScopeExist);
- var scope = new ApiScope(GuidGenerator.Create(), name, displayName, description,
- required, emphasize,
- showInDiscoveryDocument, enabled);
+ var scope = new ApiScope
+ (
+ GuidGenerator.Create(),
+ name,
+ displayName,
+ description,
+ required,
+ emphasize,
+ showInDiscoveryDocument,
+ enabled
+ );
return await _apiScopeRepository.InsertAsync(scope);
}
@@ -67,7 +78,7 @@ namespace Lion.AbpPro.IdentityServer
bool showInDiscoveryDocument)
{
var apiScope = await _apiScopeRepository.FindAsync(id, false);
- if (null == apiScope) throw new UserFriendlyException(message: $"{name}不存在");
+ if (null == apiScope) throw new BusinessException(AbpProDomainErrorCodes.ApiScopeNotExist);
apiScope.DisplayName = displayName;
apiScope.Description = description;
apiScope.Enabled = enabled;
@@ -77,18 +88,25 @@ namespace Lion.AbpPro.IdentityServer
return await _apiScopeRepository.UpdateAsync(apiScope);
}
- public Task DeleteAsync(Guid id, bool autoSave = false,
+ public Task DeleteAsync(
+ Guid id,
+ bool autoSave = false,
CancellationToken cancellationToken = default)
{
return _apiScopeRepository.DeleteAsync(id, autoSave, cancellationToken);
}
- public async Task> FindAllAsync(
- CancellationToken cancellationToken = default)
+ public async Task> FindAllAsync(CancellationToken cancellationToken = default)
{
- return await _apiScopeRepository.GetListAsync("CreationTime desc", 0, Int32.MaxValue,
- null, false,
- cancellationToken);
+ return await _apiScopeRepository.GetListAsync
+ (
+ "CreationTime desc",
+ 0,
+ Int32.MaxValue,
+ null,
+ false,
+ cancellationToken
+ );
}
}
}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerClientManager.cs b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerClientManager.cs
index ae0fdc7d..08805b75 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerClientManager.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdenityServerClientManager.cs
@@ -50,7 +50,7 @@ namespace Lion.AbpPro.IdentityServer
string description, string allowedGrantTypes)
{
var entity = await _clientRepository.FindByClientIdAsync(clientId);
- if (null != entity) throw new UserFriendlyException(message: "当前ClientId已存在");
+ if (null != entity) throw new BusinessException(AbpProDomainErrorCodes.ApiClientExist);
entity = new Client(GuidGenerator.Create(), clientId)
{
ClientName = clientName, Description = description,
@@ -108,7 +108,7 @@ namespace Lion.AbpPro.IdentityServer
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null)
{
- throw new UserFriendlyException(message: $"{clientId}不存在");
+ throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
}
client.ClientName = clientName;
@@ -180,7 +180,7 @@ namespace Lion.AbpPro.IdentityServer
public async Task UpdateScopesAsync(string clientId, List scopes)
{
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
client.RemoveAllScopes();
foreach (var item in scopes.Distinct())
@@ -201,7 +201,7 @@ namespace Lion.AbpPro.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
if (client.RedirectUris.Any(e => e.RedirectUri == uri.Trim()))
{
return client;
@@ -220,7 +220,7 @@ namespace Lion.AbpPro.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
if (client.RedirectUris.Any(e => e.RedirectUri == uri.Trim()))
{
client.RemoveRedirectUri(uri);
@@ -239,7 +239,7 @@ namespace Lion.AbpPro.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
if (client.PostLogoutRedirectUris.Any(e => e.PostLogoutRedirectUri == uri))
{
return client;
@@ -256,7 +256,7 @@ namespace Lion.AbpPro.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
if (client.PostLogoutRedirectUris.Any(e => e.PostLogoutRedirectUri == uri))
{
client.RemovePostLogoutRedirectUri(uri);
@@ -273,7 +273,7 @@ namespace Lion.AbpPro.IdentityServer
{
origin = origin.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
if (client.AllowedCorsOrigins.Any(e => e.Origin == origin))
{
return client;
@@ -292,7 +292,7 @@ namespace Lion.AbpPro.IdentityServer
{
origin = origin.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
if (client.AllowedCorsOrigins.Any(e => e.Origin == origin))
{
client.RemoveCorsOrigin(origin);
@@ -305,7 +305,7 @@ namespace Lion.AbpPro.IdentityServer
public async Task EnabledAsync(string clientId, bool enabled)
{
var client = await _clientRepository.FindByClientIdAsync(clientId);
- if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
+ if (client == null) throw new BusinessException(AbpProDomainErrorCodes.ApiClientNotExist);
client.Enabled = enabled;
return await _clientRepository.UpdateAsync(client);
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdentityResourceManager.cs b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdentityResourceManager.cs
index 3f6fb1fc..6453c284 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdentityResourceManager.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain/IdentityServer/IdentityResourceManager.cs
@@ -56,7 +56,7 @@ namespace Lion.AbpPro.IdentityServer
bool showInDiscoveryDocument)
{
var identityResource = await _identityResourceRepository.FindByNameAsync(name, false);
- if (null != identityResource) throw new UserFriendlyException(message: $"{name}已存在");
+ if (null != identityResource) throw new BusinessException(AbpProDomainErrorCodes.IdentityResourceExist);
identityResource = new IdentityResource(GuidGenerator.Create(), name, displayName,
description, enabled,
required,
@@ -74,7 +74,7 @@ namespace Lion.AbpPro.IdentityServer
bool showInDiscoveryDocument)
{
var identityResource = await _identityResourceRepository.FindByNameAsync(name, false);
- if (null == identityResource) throw new UserFriendlyException(message: $"{name}不存在");
+ if (null == identityResource) throw new BusinessException(AbpProDomainErrorCodes.IdentityResourceNotExist);
identityResource.DisplayName = displayName;
identityResource.Description = description;
identityResource.Enabled = enabled;
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
index 0088f421..06d05d2f 100644
--- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
@@ -52,11 +52,12 @@ namespace Lion.AbpPro.EntityFrameworkCore
{
/* The main point to change your DBMS.
* See also AbpProMigrationsDbContextFactory for EF Core tooling. */
+ options.UseMySQL();
options.PreConfigure(options =>
{
options.DbContextOptions.UseBatchEF_MySQLPomelo();
});
- options.UseMySQL();
+
});
}
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProMigrationsDbContextFactory.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProMigrationsDbContextFactory.cs
index e5270e67..c8213b13 100644
--- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProMigrationsDbContextFactory.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProMigrationsDbContextFactory.cs
@@ -1,3 +1,4 @@
+using System;
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
@@ -24,10 +25,21 @@ namespace Lion.AbpPro.EntityFrameworkCore
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
- .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../Lion.AbpPro.DbMigrator/"))
- .AddJsonFile("appsettings.json", optional: false);
+ .SetBasePath
+ (
+ Path.Combine
+ (
+ Directory.GetCurrentDirectory(),
+ "../Lion.AbpPro.DbMigrator/"
+ )
+ )
+ .AddJsonFile
+ (
+ "appsettings.json",
+ false
+ );
return builder.Build();
}
}
-}
+}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAbpProDbSchemaMigrator.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAbpProDbSchemaMigrator.cs
index d3c8f1d8..9cb3547f 100644
--- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAbpProDbSchemaMigrator.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAbpProDbSchemaMigrator.cs
@@ -12,8 +12,7 @@ namespace Lion.AbpPro.EntityFrameworkCore
{
private readonly IServiceProvider _serviceProvider;
- public EntityFrameworkCoreAbpProDbSchemaMigrator(
- IServiceProvider serviceProvider)
+ public EntityFrameworkCoreAbpProDbSchemaMigrator(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
diff --git a/aspnet-core/services/src/Lion.AbpPro.HttpApi/Controllers/Systems/OrganizationUnitController.cs b/aspnet-core/services/src/Lion.AbpPro.HttpApi/Controllers/Systems/OrganizationUnitController.cs
new file mode 100644
index 00000000..e0c26695
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.HttpApi/Controllers/Systems/OrganizationUnitController.cs
@@ -0,0 +1,105 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Lion.AbpPro.Extension.Customs.Dtos;
+using Lion.AbpPro.OrganizationUnits;
+using Lion.AbpPro.OrganizationUnits.Dto;
+using Microsoft.AspNetCore.Mvc;
+using Swashbuckle.AspNetCore.Annotations;
+using Volo.Abp.Application.Dtos;
+
+namespace Lion.AbpPro.Controllers.Systems;
+
+[Route("OrganizationUnits")]
+public class OrganizationUnitController : AbpProController, IOrganizationUnitAppService
+{
+ private readonly IOrganizationUnitAppService _organizationUnitAppService;
+
+ public OrganizationUnitController(IOrganizationUnitAppService organizationUnitAppService)
+ {
+ _organizationUnitAppService = organizationUnitAppService;
+ }
+
+ [HttpPost("tree")]
+ [SwaggerOperation(summary: "获取组织机构树", Tags = new[] { "OrganizationUnits" })]
+ public Task> GetTreeAsync()
+ {
+ return _organizationUnitAppService.GetTreeAsync();
+ }
+
+ [HttpPost("create")]
+ [SwaggerOperation(summary: "创建组织机构", Tags = new[] { "OrganizationUnits" })]
+ public Task CreateAsync(CreateOrganizationUnitInput input)
+ {
+ return _organizationUnitAppService.CreateAsync(input);
+ }
+
+ [HttpPost("delete")]
+ [SwaggerOperation(summary: "删除组织机构", Tags = new[] { "OrganizationUnits" })]
+ public Task DeleteAsync(IdInput input)
+ {
+ return _organizationUnitAppService.DeleteAsync(input);
+ }
+
+ [HttpPost("update")]
+ [SwaggerOperation(summary: "编辑组织机构", Tags = new[] { "OrganizationUnits" })]
+ public Task UpdateAsync(UpdateOrganizationUnitInput input)
+ {
+ return _organizationUnitAppService.UpdateAsync(input);
+ }
+
+ [HttpPost("addRoleToOrganizationUnitAsync")]
+ [SwaggerOperation(summary: "向组织机构添加角色", Tags = new[] { "OrganizationUnits" })]
+ public Task AddRoleToOrganizationUnitAsync(AddRoleToOrganizationUnitInput input)
+ {
+ return _organizationUnitAppService.AddRoleToOrganizationUnitAsync(input);
+ }
+
+ [HttpPost("removeRoleFromOrganizationUnitAsync")]
+ [SwaggerOperation(summary: "向组织机构删除角色", Tags = new[] { "OrganizationUnits" })]
+ public Task RemoveRoleFromOrganizationUnitAsync(RemoveRoleToOrganizationUnitInput input)
+ {
+ return _organizationUnitAppService.RemoveRoleFromOrganizationUnitAsync(input);
+ }
+
+ [HttpPost("addUserToOrganizationUnit")]
+ [SwaggerOperation(summary: "向组织机构添加用户", Tags = new[] { "OrganizationUnits" })]
+ public Task AddUserToOrganizationUnitAsync(AddUserToOrganizationUnitInput input)
+ {
+ return _organizationUnitAppService.AddUserToOrganizationUnitAsync(input);
+ }
+
+ [HttpPost("removeUserFromOrganizationUnit")]
+ [SwaggerOperation(summary: "向组织机构删除用户", Tags = new[] { "OrganizationUnits" })]
+ public Task RemoveUserFromOrganizationUnitAsync(RemoveUserToOrganizationUnitInput input)
+ {
+ return _organizationUnitAppService.RemoveUserFromOrganizationUnitAsync(input);
+ }
+
+ [HttpPost("getUsers")]
+ [SwaggerOperation(summary: "分页获取组织机构下用户", Tags = new[] { "OrganizationUnits" })]
+ public Task> GetUsersAsync(GetOrganizationUnitUserInput input)
+ {
+ return _organizationUnitAppService.GetUsersAsync(input);
+ }
+
+ [HttpPost("getRoles")]
+ [SwaggerOperation(summary: "分页获取组织机构下角色", Tags = new[] { "OrganizationUnits" })]
+ public Task> GetRolesAsync(GetOrganizationUnitRoleInput input)
+ {
+ return _organizationUnitAppService.GetRolesAsync(input);
+ }
+
+ [HttpPost("getUnAddUsers")]
+ [SwaggerOperation(summary: "获取不在组织机构的用户", Tags = new[] { "OrganizationUnits" })]
+ public Task> GetUnAddUsersAsync(GetUnAddUserInput input)
+ {
+ return _organizationUnitAppService.GetUnAddUsersAsync(input);
+ }
+
+ [HttpPost("getUnAddRoles")]
+ [SwaggerOperation(summary: "获取不在组织机构的角色", Tags = new[] { "OrganizationUnits" })]
+ public Task> GetUnAddRolessAsync(GetUnAddRoleInput input)
+ {
+ return _organizationUnitAppService.GetUnAddRolessAsync(input);
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiResourceManager_Tests.cs b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiResourceManager_Tests.cs
index cca9b243..ae1b8e34 100644
--- a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiResourceManager_Tests.cs
+++ b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiResourceManager_Tests.cs
@@ -61,11 +61,11 @@ namespace Lion.AbpPro.IdentityServer
[Fact]
public async Task Shuold_CreateAsync_Name_Repetition_Exception()
{
- (await Should.ThrowAsync(async () =>
+ (await Should.ThrowAsync(async () =>
{
var result = await _idenityServerApiResourceManager.CreateAsync(Guid.NewGuid(),
"ApiResource_Test", "单元测试创建", "Xunit", true, "", false, "1q2w3E*");
- })).Message.ShouldBe("ApiResource已存在");
+ })).Code.ShouldBe(AbpProDomainErrorCodes.ApiResourceExist);
}
diff --git a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiScopeManager_Tests.cs b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiScopeManager_Tests.cs
index 8ef230c3..8e63b289 100644
--- a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiScopeManager_Tests.cs
+++ b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerApiScopeManager_Tests.cs
@@ -59,11 +59,11 @@ namespace Lion.AbpPro.IdentityServer
[Fact]
public async Task Shuold_CreateAsync_Name_Repetition_Exception()
{
- (await Should.ThrowAsync(async () =>
+ (await Should.ThrowAsync(async () =>
{
var result = await _idenityServerApiScopeManager.CreateAsync(
"ApiScope_Test", "单元测试创建", "Xunit", true, false, false, true);
- })).Message.ShouldBe("ApiScope_Test已存在");
+ })).Code.ShouldBe(AbpProDomainErrorCodes.ApiScopeExist);
}
// [Fact]
diff --git a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerClientManager_Tests.cs b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerClientManager_Tests.cs
index 76a3faff..a9f4d341 100644
--- a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerClientManager_Tests.cs
+++ b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdenityServerClientManager_Tests.cs
@@ -60,12 +60,12 @@ namespace Lion.AbpPro.IdentityServer
[Fact]
public async Task Shuold_CreateAsync_Name_Repetition_Exception()
{
- (await Should.ThrowAsync(async () =>
+ (await Should.ThrowAsync(async () =>
{
var result =
await _idenityServerClientManager.CreateAsync("Test_Client", "XunitName",
"desc", "test");
- })).Message.ShouldBe("当前ClientId已存在");
+ })).Code.ShouldBe(AbpProDomainErrorCodes.ApiClientExist);
}
[Fact]
diff --git a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdentityResourceManager_Tests.cs b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdentityResourceManager_Tests.cs
index d929f294..c5c33753 100644
--- a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdentityResourceManager_Tests.cs
+++ b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/IdentityServer/IdentityResourceManager_Tests.cs
@@ -63,13 +63,13 @@ namespace Lion.AbpPro.IdentityServer
[Fact]
public async Task Shuold_CreateAsync_Name_Repetition_Exception()
{
- (await Should.ThrowAsync(async () =>
+ (await Should.ThrowAsync(async () =>
{
var result = await _identityResourceManager.CreateAsync("openid", "单元测试",
"desc", true, false,
false,
false);
- })).Message.ShouldBe("openid已存在");
+ })).Code.ShouldBe(AbpProDomainErrorCodes.IdentityResourceExist);
}
diff --git a/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Swaggers/HiddenAbpDefaultApiFilter.cs b/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Swaggers/HiddenAbpDefaultApiFilter.cs
index 50a74af7..0549210b 100644
--- a/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Swaggers/HiddenAbpDefaultApiFilter.cs
+++ b/aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Swaggers/HiddenAbpDefaultApiFilter.cs
@@ -46,7 +46,9 @@ namespace Lion.AbpPro.Shared.Hosting.Microservices.Swaggers
"/api/identity/my-profile",
"/api/identity",
"/api/multi-tenancy/tenants",
- "/api/setting-management/emailing"
+ "/api/setting-management/emailing",
+ "/configuration",
+ "/outputcache"
};
}
}
diff --git a/vben271/src/locales/lang/en/routes/admin.ts b/vben271/src/locales/lang/en/routes/admin.ts
index 6e864c2d..8e3b136e 100644
--- a/vben271/src/locales/lang/en/routes/admin.ts
+++ b/vben271/src/locales/lang/en/routes/admin.ts
@@ -29,7 +29,7 @@ export default {
audit_httpMethod: 'HttpMethod',
audit_httpStatusCode: 'HttpStatusCode',
audit_httpRequest: 'HttpRequest',
- audit_ipAdrress: 'IP Address',
+ audit_ipAddress: 'IP Address',
audit_time: 'Time',
audit_duration: 'Execution Duration(ms)',
audit_url: 'URL',
@@ -68,4 +68,11 @@ export default {
editPasswordMessage: 'The passwords entered twice are inconsistent. Procedure',
executionTime: 'ExecutionTime',
executionDuration: 'ExecutionDuration(Millisecond)',
+ organizationUnitName: 'Name',
+ parentOrganizationUnitName: 'ParentOrganizationUnit',
+ organizationUnitManagement: 'OrganizationUnitManagement',
+ createRootOrganizationUnit: 'CreateRootOrganizationUnit',
+ organizationUnit: 'OrganizationUnit',
+ member: 'Member',
+ role: 'Role',
};
diff --git a/vben271/src/locales/lang/zh-CN/routes/admin.ts b/vben271/src/locales/lang/zh-CN/routes/admin.ts
index 67ed6afe..291cc7c6 100644
--- a/vben271/src/locales/lang/zh-CN/routes/admin.ts
+++ b/vben271/src/locales/lang/zh-CN/routes/admin.ts
@@ -26,7 +26,7 @@ export default {
audit_httpMethod: 'Http方法',
audit_httpStatusCode: 'Http状态码',
audit_httpRequest: 'Http请求',
- audit_ipAdrress: 'IP地址',
+ audit_ipAddress: 'IP地址',
audit_time: '时间',
audit_duration: '持续时间(ms)',
audit_url: 'Url地址',
@@ -67,5 +67,11 @@ export default {
editPasswordMessage: '输入的2次密码不一致',
executionTime: '执行时间',
executionDuration: '响应时间(毫秒)',
-
+ organizationUnitName: '名称',
+ parentOrganizationUnitName: '上级组织机构',
+ organizationUnitManagement: '组织机构管理',
+ createRootOrganizationUnit: '新增根机构',
+ organizationUnit: '组织机构',
+ member: '成员',
+ role: '角色',
};
diff --git a/vben271/src/router/index.ts b/vben271/src/router/index.ts
index fa5b4aec..96decf09 100644
--- a/vben271/src/router/index.ts
+++ b/vben271/src/router/index.ts
@@ -1,7 +1,7 @@
import { createWebHistory, RouteRecordRaw } from "vue-router";
import type { App } from "vue";
-import { createRouter, createWebHashHistory } from "vue-router";
+import { createRouter } from "vue-router";
import { basicRoutes } from "./routes";
// 白名单应该包含基本静态路由
diff --git a/vben271/src/router/routes/modules/admin.ts b/vben271/src/router/routes/modules/admin.ts
index 0be6e4b5..9da424c6 100644
--- a/vben271/src/router/routes/modules/admin.ts
+++ b/vben271/src/router/routes/modules/admin.ts
@@ -33,6 +33,16 @@ const admin: AppRouteModule = {
icon: 'ant-design:lock-outlined',
},
},
+ {
+ path: 'organizationUnit',
+ name: 'organizationUnit',
+ component: () => import('/@/views/admin/organizationUnits/OrganizationUnit.vue'),
+ meta: {
+ title: t('routes.admin.organizationUnitManagement'),
+ icon: 'ant-design:gold-outlined',
+ policy: 'System.OrganizationUnitManagement',
+ },
+ },
{
path: 'settings',
name: 'Settings',
diff --git a/vben271/src/services/ServiceProxies.ts b/vben271/src/services/ServiceProxies.ts
index d65062fe..b289227e 100644
--- a/vben271/src/services/ServiceProxies.ts
+++ b/vben271/src/services/ServiceProxies.ts
@@ -4052,121 +4052,6 @@ export class FilesServiceProxy extends ServiceProxyBase {
}
}
-export class FileConfigurationServiceProxy extends ServiceProxyBase {
- private instance: AxiosInstance;
- private baseUrl: string;
- protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
-
- constructor(baseUrl?: string, instance?: AxiosInstance) {
- super();
- this.instance = instance ? instance : axios.create();
- this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "";
- }
-
- /**
- * @return Success
- */
- configurationGet( cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/configuration";
- url_ = url_.replace(/[?&]$/, "");
-
- let options_ = {
- method: "GET",
- url: url_,
- headers: {
- },
- cancelToken
- };
-
- return this.transformOptions(options_).then(transformedOptions_ => {
- return this.instance.request(transformedOptions_);
- }).catch((_error: any) => {
- if (isAxiosError(_error) && _error.response) {
- return _error.response;
- } else {
- throw _error;
- }
- }).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processConfigurationGet(_response));
- });
- }
-
- protected processConfigurationGet(response: AxiosResponse): Promise {
- const status = response.status;
- let _headers: any = {};
- if (response.headers && typeof response.headers === "object") {
- for (let k in response.headers) {
- if (response.headers.hasOwnProperty(k)) {
- _headers[k] = response.headers[k];
- }
- }
- }
- if (status === 200) {
- const _responseText = response.data;
- return Promise.resolve(null);
-
- } else if (status !== 200 && status !== 204) {
- const _responseText = response.data;
- return throwException("An unexpected server error occurred.", status, _responseText, _headers);
- }
- return Promise.resolve(null);
- }
-
- /**
- * @param body (optional)
- * @return Success
- */
- configurationPost(body: FileConfiguration | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/configuration";
- url_ = url_.replace(/[?&]$/, "");
-
- const content_ = JSON.stringify(body);
-
- let options_ = {
- data: content_,
- method: "POST",
- url: url_,
- headers: {
- "Content-Type": "application/json",
- },
- cancelToken
- };
-
- return this.transformOptions(options_).then(transformedOptions_ => {
- return this.instance.request(transformedOptions_);
- }).catch((_error: any) => {
- if (isAxiosError(_error) && _error.response) {
- return _error.response;
- } else {
- throw _error;
- }
- }).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processConfigurationPost(_response));
- });
- }
-
- protected processConfigurationPost(response: AxiosResponse): Promise {
- const status = response.status;
- let _headers: any = {};
- if (response.headers && typeof response.headers === "object") {
- for (let k in response.headers) {
- if (response.headers.hasOwnProperty(k)) {
- _headers[k] = response.headers[k];
- }
- }
- }
- if (status === 200) {
- const _responseText = response.data;
- return Promise.resolve(null);
-
- } else if (status !== 200 && status !== 204) {
- const _responseText = response.data;
- return throwException("An unexpected server error occurred.", status, _responseText, _headers);
- }
- return Promise.resolve(null);
- }
-}
-
export class IdentityResourceServiceProxy extends ServiceProxyBase {
private instance: AxiosInstance;
private baseUrl: string;
@@ -5307,7 +5192,7 @@ export class NotificationServiceProxy extends ServiceProxyBase {
}
}
-export class OutputCacheServiceProxy extends ServiceProxyBase {
+export class OrganizationUnitsServiceProxy extends ServiceProxyBase {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
@@ -5319,19 +5204,18 @@ export class OutputCacheServiceProxy extends ServiceProxyBase {
}
/**
+ * 获取组织机构树
* @return Success
*/
- outputcache(region: string , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/outputcache/{region}";
- if (region === undefined || region === null)
- throw new Error("The parameter 'region' must be defined.");
- url_ = url_.replace("{region}", encodeURIComponent("" + region));
+ tree( cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/tree";
url_ = url_.replace(/[?&]$/, "");
let options_ = {
- method: "DELETE",
+ method: "POST",
url: url_,
headers: {
+ "Accept": "text/plain"
},
cancelToken
};
@@ -5345,11 +5229,11 @@ export class OutputCacheServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processOutputcache(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processTree(_response));
});
}
- protected processOutputcache(response: AxiosResponse): Promise {
+ protected processTree(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -5361,34 +5245,74 @@ export class OutputCacheServiceProxy extends ServiceProxyBase {
}
if (status === 200) {
const _responseText = response.data;
- return Promise.resolve(null);
+ let result200: any = null;
+ let resultData200 = _responseText;
+ if (Array.isArray(resultData200)) {
+ result200 = [] as any;
+ for (let item of resultData200)
+ result200!.push(TreeOutput.fromJS(item));
+ }
+ else {
+ result200 = null;
+ }
+ return Promise.resolve(result200);
+
+ } else if (status === 403) {
+ const _responseText = response.data;
+ let result403: any = null;
+ let resultData403 = _responseText;
+ result403 = RemoteServiceErrorResponse.fromJS(resultData403);
+ return throwException("Forbidden", status, _responseText, _headers, result403);
+
+ } else if (status === 401) {
+ const _responseText = response.data;
+ let result401: any = null;
+ let resultData401 = _responseText;
+ result401 = RemoteServiceErrorResponse.fromJS(resultData401);
+ return throwException("Unauthorized", status, _responseText, _headers, result401);
+
+ } else if (status === 400) {
+ const _responseText = response.data;
+ let result400: any = null;
+ let resultData400 = _responseText;
+ result400 = RemoteServiceErrorResponse.fromJS(resultData400);
+ return throwException("Bad Request", status, _responseText, _headers, result400);
+
+ } else if (status === 404) {
+ const _responseText = response.data;
+ let result404: any = null;
+ let resultData404 = _responseText;
+ result404 = RemoteServiceErrorResponse.fromJS(resultData404);
+ return throwException("Not Found", status, _responseText, _headers, result404);
+
+ } else if (status === 501) {
+ const _responseText = response.data;
+ let result501: any = null;
+ let resultData501 = _responseText;
+ result501 = RemoteServiceErrorResponse.fromJS(resultData501);
+ return throwException("Server Error", status, _responseText, _headers, result501);
+
+ } else if (status === 500) {
+ const _responseText = response.data;
+ let result500: any = null;
+ let resultData500 = _responseText;
+ result500 = RemoteServiceErrorResponse.fromJS(resultData500);
+ return throwException("Server Error", status, _responseText, _headers, result500);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
- }
-}
-
-export class PermissionsServiceProxy extends ServiceProxyBase {
- private instance: AxiosInstance;
- private baseUrl: string;
- protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
-
- constructor(baseUrl?: string, instance?: AxiosInstance) {
- super();
- this.instance = instance ? instance : axios.create();
- this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "";
+ return Promise.resolve(null);
}
/**
- * 获取角色权限
+ * 创建组织机构
* @param body (optional)
* @return Success
*/
- tree(body: GetPermissionInput | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Permissions/tree";
+ create(body: CreateOrganizationUnitInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/create";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
@@ -5399,7 +5323,6 @@ export class PermissionsServiceProxy extends ServiceProxyBase {
url: url_,
headers: {
"Content-Type": "application/json",
- "Accept": "text/plain"
},
cancelToken
};
@@ -5413,11 +5336,11 @@ export class PermissionsServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processTree(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreate(_response));
});
}
- protected processTree(response: AxiosResponse): Promise {
+ protected processCreate(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -5429,10 +5352,7 @@ export class PermissionsServiceProxy extends ServiceProxyBase {
}
if (status === 200) {
const _responseText = response.data;
- let result200: any = null;
- let resultData200 = _responseText;
- result200 = PermissionOutput.fromJS(resultData200);
- return Promise.resolve(result200);
+ return Promise.resolve(null);
} else if (status === 403) {
const _responseText = response.data;
@@ -5480,16 +5400,16 @@ export class PermissionsServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
+ return Promise.resolve(null);
}
/**
- * 更新角色
+ * 删除组织机构
* @param body (optional)
* @return Success
*/
- update(body: UpdateRolePermissionsInput | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Permissions/update";
+ delete(body: IdInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/delete";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
@@ -5513,11 +5433,11 @@ export class PermissionsServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processUpdate(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDelete(_response));
});
}
- protected processUpdate(response: AxiosResponse): Promise {
+ protected processDelete(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -5579,32 +5499,24 @@ export class PermissionsServiceProxy extends ServiceProxyBase {
}
return Promise.resolve(null);
}
-}
-
-export class RolesServiceProxy extends ServiceProxyBase {
- private instance: AxiosInstance;
- private baseUrl: string;
- protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
-
- constructor(baseUrl?: string, instance?: AxiosInstance) {
- super();
- this.instance = instance ? instance : axios.create();
- this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "";
- }
/**
- * 获取所有角色
+ * 编辑组织机构
+ * @param body (optional)
* @return Success
*/
- all( cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Roles/all";
+ update(body: UpdateOrganizationUnitInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/update";
url_ = url_.replace(/[?&]$/, "");
+ const content_ = JSON.stringify(body);
+
let options_ = {
+ data: content_,
method: "POST",
url: url_,
headers: {
- "Accept": "text/plain"
+ "Content-Type": "application/json",
},
cancelToken
};
@@ -5618,11 +5530,11 @@ export class RolesServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processAll(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processUpdate(_response));
});
}
- protected processAll(response: AxiosResponse): Promise {
+ protected processUpdate(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -5634,10 +5546,7 @@ export class RolesServiceProxy extends ServiceProxyBase {
}
if (status === 200) {
const _responseText = response.data;
- let result200: any = null;
- let resultData200 = _responseText;
- result200 = IdentityRoleDtoListResultDto.fromJS(resultData200);
- return Promise.resolve(result200);
+ return Promise.resolve(null);
} else if (status === 403) {
const _responseText = response.data;
@@ -5685,16 +5594,16 @@ export class RolesServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
+ return Promise.resolve(null);
}
/**
- * 分页获取角色
+ * 向组织机构添加角色
* @param body (optional)
* @return Success
*/
- page(body: PagingRoleListInput | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Roles/page";
+ addRoleToOrganizationUnit(body: AddRoleToOrganizationUnitInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/addRoleToOrganizationUnitAsync";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
@@ -5705,7 +5614,6 @@ export class RolesServiceProxy extends ServiceProxyBase {
url: url_,
headers: {
"Content-Type": "application/json",
- "Accept": "text/plain"
},
cancelToken
};
@@ -5719,11 +5627,11 @@ export class RolesServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processPage(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processAddRoleToOrganizationUnit(_response));
});
}
- protected processPage(response: AxiosResponse): Promise {
+ protected processAddRoleToOrganizationUnit(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -5735,10 +5643,7 @@ export class RolesServiceProxy extends ServiceProxyBase {
}
if (status === 200) {
const _responseText = response.data;
- let result200: any = null;
- let resultData200 = _responseText;
- result200 = IdentityRoleDtoPagedResultDto.fromJS(resultData200);
- return Promise.resolve(result200);
+ return Promise.resolve(null);
} else if (status === 403) {
const _responseText = response.data;
@@ -5786,16 +5691,16 @@ export class RolesServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
+ return Promise.resolve(null);
}
/**
- * 创建角色
+ * 向组织机构删除角色
* @param body (optional)
* @return Success
*/
- create(body: IdentityRoleCreateDto | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Roles/create";
+ removeRoleFromOrganizationUnit(body: RemoveRoleToOrganizationUnitInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/removeRoleFromOrganizationUnitAsync";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
@@ -5806,7 +5711,6 @@ export class RolesServiceProxy extends ServiceProxyBase {
url: url_,
headers: {
"Content-Type": "application/json",
- "Accept": "text/plain"
},
cancelToken
};
@@ -5820,11 +5724,11 @@ export class RolesServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreate(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processRemoveRoleFromOrganizationUnit(_response));
});
}
- protected processCreate(response: AxiosResponse): Promise {
+ protected processRemoveRoleFromOrganizationUnit(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -5836,10 +5740,7 @@ export class RolesServiceProxy extends ServiceProxyBase {
}
if (status === 200) {
const _responseText = response.data;
- let result200: any = null;
- let resultData200 = _responseText;
- result200 = IdentityRoleDto.fromJS(resultData200);
- return Promise.resolve(result200);
+ return Promise.resolve(null);
} else if (status === 403) {
const _responseText = response.data;
@@ -5887,16 +5788,16 @@ export class RolesServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
+ return Promise.resolve(null);
}
/**
- * 更新角色
+ * 向组织机构添加用户
* @param body (optional)
* @return Success
*/
- update(body: UpdateRoleInput | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Roles/update";
+ addUserToOrganizationUnit(body: AddUserToOrganizationUnitInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/addUserToOrganizationUnit";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
@@ -5907,7 +5808,6 @@ export class RolesServiceProxy extends ServiceProxyBase {
url: url_,
headers: {
"Content-Type": "application/json",
- "Accept": "text/plain"
},
cancelToken
};
@@ -5921,11 +5821,11 @@ export class RolesServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processUpdate(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processAddUserToOrganizationUnit(_response));
});
}
- protected processUpdate(response: AxiosResponse): Promise {
+ protected processAddUserToOrganizationUnit(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -5937,10 +5837,7 @@ export class RolesServiceProxy extends ServiceProxyBase {
}
if (status === 200) {
const _responseText = response.data;
- let result200: any = null;
- let resultData200 = _responseText;
- result200 = IdentityRoleDto.fromJS(resultData200);
- return Promise.resolve(result200);
+ return Promise.resolve(null);
} else if (status === 403) {
const _responseText = response.data;
@@ -5988,16 +5885,16 @@ export class RolesServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
+ return Promise.resolve(null);
}
/**
- * 删除角色
+ * 向组织机构删除用户
* @param body (optional)
* @return Success
*/
- delete(body: IdInput | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Roles/delete";
+ removeUserFromOrganizationUnit(body: RemoveUserToOrganizationUnitInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/removeUserFromOrganizationUnit";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
@@ -6021,11 +5918,11 @@ export class RolesServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDelete(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processRemoveUserFromOrganizationUnit(_response));
});
}
- protected processDelete(response: AxiosResponse): Promise {
+ protected processRemoveUserFromOrganizationUnit(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -6087,30 +5984,24 @@ export class RolesServiceProxy extends ServiceProxyBase {
}
return Promise.resolve(null);
}
-}
-
-export class SampleServiceProxy extends ServiceProxyBase {
- private instance: AxiosInstance;
- private baseUrl: string;
- protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
-
- constructor(baseUrl?: string, instance?: AxiosInstance) {
- super();
- this.instance = instance ? instance : axios.create();
- this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "";
- }
/**
+ * 分页获取组织机构下用户
+ * @param body (optional)
* @return Success
*/
- sample( cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/api/FileManagement/sample";
+ getUsers(body: GetOrganizationUnitUserInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/getUsers";
url_ = url_.replace(/[?&]$/, "");
+ const content_ = JSON.stringify(body);
+
let options_ = {
- method: "GET",
+ data: content_,
+ method: "POST",
url: url_,
headers: {
+ "Content-Type": "application/json",
"Accept": "text/plain"
},
cancelToken
@@ -6125,11 +6016,11 @@ export class SampleServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processSample(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetUsers(_response));
});
}
- protected processSample(response: AxiosResponse): Promise {
+ protected processGetUsers(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -6143,8 +6034,8 @@ export class SampleServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
- result200 = SampleDto.fromJS(resultData200);
- return Promise.resolve(result200);
+ result200 = GetOrganizationUnitUserOutputPagedResultDto.fromJS(resultData200);
+ return Promise.resolve(result200);
} else if (status === 403) {
const _responseText = response.data;
@@ -6192,20 +6083,26 @@ export class SampleServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
+ return Promise.resolve(null);
}
/**
+ * 分页获取组织机构下角色
+ * @param body (optional)
* @return Success
*/
- authorized( cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/api/FileManagement/sample/authorized";
+ getRoles(body: GetOrganizationUnitRoleInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/getRoles";
url_ = url_.replace(/[?&]$/, "");
+ const content_ = JSON.stringify(body);
+
let options_ = {
- method: "GET",
+ data: content_,
+ method: "POST",
url: url_,
headers: {
+ "Content-Type": "application/json",
"Accept": "text/plain"
},
cancelToken
@@ -6220,11 +6117,11 @@ export class SampleServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processAuthorized(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetRoles(_response));
});
}
- protected processAuthorized(response: AxiosResponse): Promise {
+ protected processGetRoles(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -6238,8 +6135,8 @@ export class SampleServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
- result200 = SampleDto.fromJS(resultData200);
- return Promise.resolve(result200);
+ result200 = GetOrganizationUnitRoleOutputPagedResultDto.fromJS(resultData200);
+ return Promise.resolve(result200);
} else if (status === 403) {
const _responseText = response.data;
@@ -6287,33 +6184,26 @@ export class SampleServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
- }
-}
-
-export class SettingsServiceProxy extends ServiceProxyBase {
- private instance: AxiosInstance;
- private baseUrl: string;
- protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
-
- constructor(baseUrl?: string, instance?: AxiosInstance) {
- super();
- this.instance = instance ? instance : axios.create();
- this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "";
+ return Promise.resolve(null);
}
/**
- * 获取所有Setting
+ * 获取不在组织机构的用户
+ * @param body (optional)
* @return Success
*/
- all( cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Settings/all";
+ getUnAddUsers(body: GetUnAddUserInput | undefined , cancelToken?: CancelToken | undefined): Promise {
+ let url_ = this.baseUrl + "/OrganizationUnits/getUnAddUsers";
url_ = url_.replace(/[?&]$/, "");
+ const content_ = JSON.stringify(body);
+
let options_ = {
+ data: content_,
method: "POST",
url: url_,
headers: {
+ "Content-Type": "application/json",
"Accept": "text/plain"
},
cancelToken
@@ -6328,11 +6218,11 @@ export class SettingsServiceProxy extends ServiceProxyBase {
throw _error;
}
}).then((_response: AxiosResponse) => {
- return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processAll(_response));
+ return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processGetUnAddUsers(_response));
});
}
- protected processAll(response: AxiosResponse): Promise {
+ protected processGetUnAddUsers(response: AxiosResponse): Promise {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
@@ -6346,15 +6236,8 @@ export class SettingsServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
- if (Array.isArray(resultData200)) {
- result200 = [] as any;
- for (let item of resultData200)
- result200!.push(SettingOutput.fromJS(item));
- }
- else {
- result200 = null;
- }
- return Promise.resolve(result200);
+ result200 = GetUnAddUserOutputPagedResultDto.fromJS(resultData200);
+ return Promise.resolve(result200);
} else if (status === 403) {
const _responseText = response.data;
@@ -6402,16 +6285,16 @@ export class SettingsServiceProxy extends ServiceProxyBase {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
- return Promise.resolve(null);
+ return Promise.resolve(null);
}
/**
- * 更新Setting
+ * 获取不在组织机构的角色
* @param body (optional)
* @return Success
*/
- update(body: UpdateSettingInput | undefined , cancelToken?: CancelToken | undefined): Promise {
- let url_ = this.baseUrl + "/Settings/update";
+ getUnAddRoles(body: GetUnAddRoleInput | undefined , cancelToken?: CancelToken | undefined): Promise