Skip to content

Commit

Permalink
feat: 重构消息模块
Browse files Browse the repository at this point in the history
  • Loading branch information
WangJunZzz committed Apr 18, 2024
1 parent 08a70ab commit bd51b69
Show file tree
Hide file tree
Showing 65 changed files with 2,477 additions and 4,877 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public interface IUserAppService : IApplicationService
/// </summary>
Task<PagedResultDto<IdentityUserDto>> ListAsync(PagingUserListInput input);

/// <summary>
/// 分页查询用户
/// </summary>
Task<List<IdentityUserDto>> ListAllAsync(PagingUserListInput input);

/// <summary>
/// 用户导出列表
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ public virtual async Task<PagedResultDto<IdentityUserDto>> ListAsync(PagingUserL
base.ObjectMapper.Map<List<Volo.Abp.Identity.IdentityUser>, List<IdentityUserDto>>(source));
}

public async Task<List<IdentityUserDto>> ListAllAsync(PagingUserListInput input)
{
var request = new GetIdentityUsersInput
{
Filter = input.Filter?.Trim(),
MaxResultCount = input.PageSize,
SkipCount = input.SkipCount,
Sorting = nameof(IHasModificationTime.LastModificationTime)
};

var source = await _identityUserRepository
.GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount, request.Filter);

return ObjectMapper.Map<List<Volo.Abp.Identity.IdentityUser>, List<IdentityUserDto>>(source);

}

/// <summary>
/// 用户导出列表
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public Task<PagedResultDto<IdentityUserDto>> ListAsync(PagingUserListInput input
{
return _userAppService.ListAsync(input);
}

[HttpPost("list")]
[SwaggerOperation(summary: "分页获取用户信息", Tags = new[] { "Users" })]
public Task<List<IdentityUserDto>> ListAllAsync(PagingUserListInput input)
{
return _userAppService.ListAllAsync(input);
}

[HttpPost("export")]
[SwaggerOperation(summary: "导出用户列表", Tags = new[] { "Users" })]
[ProducesResponseType(typeof(FileContentResult), (int)HttpStatusCode.OK)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public interface INotificationHubAppService : IApplicationService
{
Task SendMessageAsync(Guid id, string title, string content, MessageType messageType,MessageLevel messageLevel, List<string> users);
Task SendMessageAsync(Guid id, string title, string content, MessageType messageType,MessageLevel messageLevel, string receiverUserId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class PagingNotificationInput : PagingBase
{
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }


/// <summary>
/// 内容
/// </summary>
public string Content { get; set; }

/// <summary>
/// 发送者Id
/// </summary>
public Guid? SenderUserId { get; set; }

/// <summary>
/// 发送者名称
/// </summary>
public string SenderUserName { get; set; }

/// <summary>
/// 接受者Id
/// </summary>
public Guid? ReceiverUserId { get; set; }

/// <summary>
/// 接受者名称
/// </summary>
public string ReceiverUserName { get; set; }

/// <summary>
/// 是否已读
/// </summary>
public bool? Read { get; set; }

/// <summary>
/// 已读开始时间
/// </summary>
public DateTime? StartReadTime { get; set; }

/// <summary>
/// 已读结束时间
/// </summary>
public DateTime? EndReadTime { get; set; }

/// <summary>
/// 消息类型
/// </summary>
public MessageType? MessageType { get; set; }
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class PagingNotificationOutput
{
public Guid Id { get; set; }

/// <summary>
/// 租户id
/// </summary>
public Guid? TenantId { get; set; }

/// <summary>
/// 消息标题
/// </summary>
public string Title { get; set; }

/// <summary>
/// 消息内容
/// </summary>
public string Content { get; set; }

/// <summary>
/// 消息类型
/// </summary>
public MessageType MessageType { get; set; }

public string MessageTypeName => MessageType.ToDescription();

/// <summary>
/// 消息等级
/// </summary>
public MessageLevel MessageLevel { get; set; }
public string MessageLevelName => MessageLevel.ToDescription();

/// <summary>
/// 发送人
/// </summary>
public Guid SenderUserId { get; set; }

/// <summary>
/// 发送人用户名
/// </summary>
public string SenderUserName { get; set; }

/// <summary>
/// 订阅人
/// 消息类型是广播消息时,订阅人为空
/// </summary>
public Guid? ReceiveUserId { get; set; }


/// <summary>
/// 接收人用户名
/// 消息类型是广播消息时,订接收人用户名为空
/// </summary>
public string ReceiveUserName { get; set; }

/// <summary>
/// 是否已读
/// </summary>
public bool Read { get; set; }

/// <summary>
/// 已读时间
/// </summary>
public DateTime? ReadTime { get; set; }

public DateTime CreationTime { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class PagingNotificationSubscriptionInput : PagingBase
{

public Guid NotificationId { get; set; }


/// <summary>
/// 接受者Id
/// </summary>
public Guid? ReceiverUserId { get; set; }

/// <summary>
/// 接受者名称
/// </summary>
public string ReceiverUserName { get; set; }

/// <summary>
/// 是否已读
/// </summary>
public bool? Read { get; set; }

/// <summary>
/// 已读开始时间
/// </summary>
public DateTime? StartReadTime { get; set; }

/// <summary>
/// 已读结束时间
/// </summary>
public DateTime? EndReadTime { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos
{
public class PagingNotificationSubscriptionOutput
{
public Guid Id { get; set; }

/// <summary>
/// 租户id
/// </summary>
public Guid? TenantId { get; set; }

/// <summary>
/// 消息Id
/// </summary>
public Guid NotificationId { get; set; }

/// <summary>
/// 接收人id
/// </summary>
public Guid ReceiveUserId { get; set; }

/// <summary>
/// 接收人用户名
/// </summary>
public string ReceiveUserName { get; set; }

/// <summary>
/// 是否已读
/// </summary>
public bool Read { get; set; }

/// <summary>
/// 已读时间
/// </summary>
public DateTime ReadTime { get; set; }

/// <summary>
/// 消息标题
/// </summary>
public string Title { get; set; }

/// <summary>
/// 消息内容
/// </summary>
public string Content { get; set; }

/// <summary>
/// 消息类型
/// </summary>
public MessageType MessageType { get; set; }

public string MessageTypeName => MessageType.ToDescription();

/// <summary>
/// 消息等级
/// </summary>
public MessageLevel MessageLevel { get; set; }
public string MessageLevelName => MessageLevel.ToDescription();

/// <summary>
/// 发送人
/// </summary>
public Guid SenderUserId { get; set; }

/// <summary>
/// 发送人用户名
/// </summary>
public string SenderUserName { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ public class SendCommonMessageInput : IValidatableObject
/// <summary>
/// 发送人
/// </summary>
public List<Guid> ReceiveIds { get; set; }
public Guid ReceiveUserId { get; set; }

public SendCommonMessageInput()
{
ReceiveIds = new List<Guid>();
}
/// <summary>
/// 发送人名称
/// </summary>
public string ReceiveUserName { get; set; }


public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
Expand All @@ -35,10 +36,5 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex
{
yield return new ValidationResult(localization[NotificationManagementErrorCodes.MessageContent], new[] { nameof(Content) });
}

if (ReceiveIds == null || ReceiveIds.Count == 0)
{
yield return new ValidationResult(localization[NotificationManagementErrorCodes.ReceiverNotNull], new[] { nameof(ReceiveIds) });
}
}
}
Loading

0 comments on commit bd51b69

Please sign in to comment.