Skip to content

Commit bd51b69

Browse files
committed
feat: 重构消息模块
1 parent 08a70ab commit bd51b69

File tree

65 files changed

+2477
-4877
lines changed

Some content is hidden

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

65 files changed

+2477
-4877
lines changed

aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public interface IUserAppService : IApplicationService
1212
/// </summary>
1313
Task<PagedResultDto<IdentityUserDto>> ListAsync(PagingUserListInput input);
1414

15+
/// <summary>
16+
/// 分页查询用户
17+
/// </summary>
18+
Task<List<IdentityUserDto>> ListAllAsync(PagingUserListInput input);
19+
1520
/// <summary>
1621
/// 用户导出列表
1722
/// </summary>

aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs

+17
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@ public virtual async Task<PagedResultDto<IdentityUserDto>> ListAsync(PagingUserL
5454
base.ObjectMapper.Map<List<Volo.Abp.Identity.IdentityUser>, List<IdentityUserDto>>(source));
5555
}
5656

57+
public async Task<List<IdentityUserDto>> ListAllAsync(PagingUserListInput input)
58+
{
59+
var request = new GetIdentityUsersInput
60+
{
61+
Filter = input.Filter?.Trim(),
62+
MaxResultCount = input.PageSize,
63+
SkipCount = input.SkipCount,
64+
Sorting = nameof(IHasModificationTime.LastModificationTime)
65+
};
66+
67+
var source = await _identityUserRepository
68+
.GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount, request.Filter);
69+
70+
return ObjectMapper.Map<List<Volo.Abp.Identity.IdentityUser>, List<IdentityUserDto>>(source);
71+
72+
}
73+
5774
/// <summary>
5875
/// 用户导出列表
5976
/// </summary>

aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ public Task<PagedResultDto<IdentityUserDto>> ListAsync(PagingUserListInput input
1919
{
2020
return _userAppService.ListAsync(input);
2121
}
22+
23+
[HttpPost("list")]
24+
[SwaggerOperation(summary: "分页获取用户信息", Tags = new[] { "Users" })]
25+
public Task<List<IdentityUserDto>> ListAllAsync(PagingUserListInput input)
26+
{
27+
return _userAppService.ListAllAsync(input);
28+
}
29+
2230
[HttpPost("export")]
2331
[SwaggerOperation(summary: "导出用户列表", Tags = new[] { "Users" })]
2432
[ProducesResponseType(typeof(FileContentResult), (int)HttpStatusCode.OK)]

aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
public interface INotificationHubAppService : IApplicationService
44
{
5-
Task SendMessageAsync(Guid id, string title, string content, MessageType messageType,MessageLevel messageLevel, List<string> users);
5+
Task SendMessageAsync(Guid id, string title, string content, MessageType messageType,MessageLevel messageLevel, string receiverUserId);
66
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
2+
{
3+
public class PagingNotificationInput : PagingBase
4+
{
5+
/// <summary>
6+
/// 标题
7+
/// </summary>
8+
public string Title { get; set; }
9+
10+
11+
/// <summary>
12+
/// 内容
13+
/// </summary>
14+
public string Content { get; set; }
15+
16+
/// <summary>
17+
/// 发送者Id
18+
/// </summary>
19+
public Guid? SenderUserId { get; set; }
20+
21+
/// <summary>
22+
/// 发送者名称
23+
/// </summary>
24+
public string SenderUserName { get; set; }
25+
26+
/// <summary>
27+
/// 接受者Id
28+
/// </summary>
29+
public Guid? ReceiverUserId { get; set; }
30+
31+
/// <summary>
32+
/// 接受者名称
33+
/// </summary>
34+
public string ReceiverUserName { get; set; }
35+
36+
/// <summary>
37+
/// 是否已读
38+
/// </summary>
39+
public bool? Read { get; set; }
40+
41+
/// <summary>
42+
/// 已读开始时间
43+
/// </summary>
44+
public DateTime? StartReadTime { get; set; }
45+
46+
/// <summary>
47+
/// 已读结束时间
48+
/// </summary>
49+
public DateTime? EndReadTime { get; set; }
50+
51+
/// <summary>
52+
/// 消息类型
53+
/// </summary>
54+
public MessageType? MessageType { get; set; }
55+
}
56+
}

aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListInput.cs

-8
This file was deleted.

aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListOutput.cs

-46
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
2+
{
3+
public class PagingNotificationOutput
4+
{
5+
public Guid Id { get; set; }
6+
7+
/// <summary>
8+
/// 租户id
9+
/// </summary>
10+
public Guid? TenantId { get; set; }
11+
12+
/// <summary>
13+
/// 消息标题
14+
/// </summary>
15+
public string Title { get; set; }
16+
17+
/// <summary>
18+
/// 消息内容
19+
/// </summary>
20+
public string Content { get; set; }
21+
22+
/// <summary>
23+
/// 消息类型
24+
/// </summary>
25+
public MessageType MessageType { get; set; }
26+
27+
public string MessageTypeName => MessageType.ToDescription();
28+
29+
/// <summary>
30+
/// 消息等级
31+
/// </summary>
32+
public MessageLevel MessageLevel { get; set; }
33+
public string MessageLevelName => MessageLevel.ToDescription();
34+
35+
/// <summary>
36+
/// 发送人
37+
/// </summary>
38+
public Guid SenderUserId { get; set; }
39+
40+
/// <summary>
41+
/// 发送人用户名
42+
/// </summary>
43+
public string SenderUserName { get; set; }
44+
45+
/// <summary>
46+
/// 订阅人
47+
/// 消息类型是广播消息时,订阅人为空
48+
/// </summary>
49+
public Guid? ReceiveUserId { get; set; }
50+
51+
52+
/// <summary>
53+
/// 接收人用户名
54+
/// 消息类型是广播消息时,订接收人用户名为空
55+
/// </summary>
56+
public string ReceiveUserName { get; set; }
57+
58+
/// <summary>
59+
/// 是否已读
60+
/// </summary>
61+
public bool Read { get; set; }
62+
63+
/// <summary>
64+
/// 已读时间
65+
/// </summary>
66+
public DateTime? ReadTime { get; set; }
67+
68+
public DateTime CreationTime { get; set; }
69+
}
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
2+
{
3+
public class PagingNotificationSubscriptionInput : PagingBase
4+
{
5+
6+
public Guid NotificationId { get; set; }
7+
8+
9+
/// <summary>
10+
/// 接受者Id
11+
/// </summary>
12+
public Guid? ReceiverUserId { get; set; }
13+
14+
/// <summary>
15+
/// 接受者名称
16+
/// </summary>
17+
public string ReceiverUserName { get; set; }
18+
19+
/// <summary>
20+
/// 是否已读
21+
/// </summary>
22+
public bool? Read { get; set; }
23+
24+
/// <summary>
25+
/// 已读开始时间
26+
/// </summary>
27+
public DateTime? StartReadTime { get; set; }
28+
29+
/// <summary>
30+
/// 已读结束时间
31+
/// </summary>
32+
public DateTime? EndReadTime { get; set; }
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
2+
{
3+
public class PagingNotificationSubscriptionOutput
4+
{
5+
public Guid Id { get; set; }
6+
7+
/// <summary>
8+
/// 租户id
9+
/// </summary>
10+
public Guid? TenantId { get; set; }
11+
12+
/// <summary>
13+
/// 消息Id
14+
/// </summary>
15+
public Guid NotificationId { get; set; }
16+
17+
/// <summary>
18+
/// 接收人id
19+
/// </summary>
20+
public Guid ReceiveUserId { get; set; }
21+
22+
/// <summary>
23+
/// 接收人用户名
24+
/// </summary>
25+
public string ReceiveUserName { get; set; }
26+
27+
/// <summary>
28+
/// 是否已读
29+
/// </summary>
30+
public bool Read { get; set; }
31+
32+
/// <summary>
33+
/// 已读时间
34+
/// </summary>
35+
public DateTime ReadTime { get; set; }
36+
37+
/// <summary>
38+
/// 消息标题
39+
/// </summary>
40+
public string Title { get; set; }
41+
42+
/// <summary>
43+
/// 消息内容
44+
/// </summary>
45+
public string Content { get; set; }
46+
47+
/// <summary>
48+
/// 消息类型
49+
/// </summary>
50+
public MessageType MessageType { get; set; }
51+
52+
public string MessageTypeName => MessageType.ToDescription();
53+
54+
/// <summary>
55+
/// 消息等级
56+
/// </summary>
57+
public MessageLevel MessageLevel { get; set; }
58+
public string MessageLevelName => MessageLevel.ToDescription();
59+
60+
/// <summary>
61+
/// 发送人
62+
/// </summary>
63+
public Guid SenderUserId { get; set; }
64+
65+
/// <summary>
66+
/// 发送人用户名
67+
/// </summary>
68+
public string SenderUserName { get; set; }
69+
}
70+
}

aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendCommonMessageInput.cs

+6-10
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ public class SendCommonMessageInput : IValidatableObject
1515
/// <summary>
1616
/// 发送人
1717
/// </summary>
18-
public List<Guid> ReceiveIds { get; set; }
18+
public Guid ReceiveUserId { get; set; }
1919

20-
public SendCommonMessageInput()
21-
{
22-
ReceiveIds = new List<Guid>();
23-
}
20+
/// <summary>
21+
/// 发送人名称
22+
/// </summary>
23+
public string ReceiveUserName { get; set; }
24+
2425

2526
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
2627
{
@@ -35,10 +36,5 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex
3536
{
3637
yield return new ValidationResult(localization[NotificationManagementErrorCodes.MessageContent], new[] { nameof(Content) });
3738
}
38-
39-
if (ReceiveIds == null || ReceiveIds.Count == 0)
40-
{
41-
yield return new ValidationResult(localization[NotificationManagementErrorCodes.ReceiverNotNull], new[] { nameof(ReceiveIds) });
42-
}
4339
}
4440
}

0 commit comments

Comments
 (0)