新增MES模块,包含供应商、客户、车辆和地磅数据记录管理功能,支持免密接口和数据同步。更新相关控制器、实体、服务和数据库配置,优化权限管理和数据字典支持,确保系统的灵活性和可扩展性。
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using YY.Admin.Core.Services;
|
||||
using YY.Admin.Core.Sync;
|
||||
|
||||
namespace YY.Admin.Infrastructure.Sync;
|
||||
|
||||
/// <summary>
|
||||
/// 将桌面用户 CRUD 写入 Outbox,通过 /sys/sync/batch 反同步到 Jeecg 后端。
|
||||
/// 断网时自动持久化,联网后续传。
|
||||
/// </summary>
|
||||
public sealed class UserSyncOutbox : IUserSyncOutbox
|
||||
{
|
||||
private readonly OutboxProcessor _outboxProcessor;
|
||||
|
||||
public UserSyncOutbox(OutboxProcessor outboxProcessor)
|
||||
{
|
||||
_outboxProcessor = outboxProcessor;
|
||||
}
|
||||
|
||||
public Task EnqueueCreateAsync(
|
||||
string userId, string account, string? realName, int? sex, DateTime? birthday, string? phone, string? email, int status, string? updateBy,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return _outboxProcessor.EnqueueAsync(
|
||||
SysUserSyncOutbox.AggregateType,
|
||||
userId,
|
||||
SysUserSyncOutbox.EventCreate,
|
||||
new { userId, account, realName, sex, birthday, phone, email, status, updateBy },
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
public Task EnqueueUpdateAsync(
|
||||
string userId, string account, string? realName, int? sex, DateTime? birthday, string? phone, string? email, int status, string? updateBy,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return _outboxProcessor.EnqueueAsync(
|
||||
SysUserSyncOutbox.AggregateType,
|
||||
userId,
|
||||
SysUserSyncOutbox.EventUpdate,
|
||||
new { userId, account, realName, sex, birthday, phone, email, status, updateBy },
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
public Task EnqueueToggleStatusAsync(
|
||||
string userId, int status, string? updateBy,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return _outboxProcessor.EnqueueAsync(
|
||||
SysUserSyncOutbox.AggregateType,
|
||||
userId,
|
||||
SysUserSyncOutbox.EventToggleStatus,
|
||||
new { userId, status, updateBy },
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
public Task EnqueueDeleteAsync(string userId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return _outboxProcessor.EnqueueAsync(
|
||||
SysUserSyncOutbox.AggregateType,
|
||||
userId,
|
||||
SysUserSyncOutbox.EventDelete,
|
||||
new { userId },
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
public Task EnqueueBatchDeleteAsync(IReadOnlyList<string> userIds, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return _outboxProcessor.EnqueueAsync(
|
||||
SysUserSyncOutbox.AggregateType,
|
||||
string.Join(",", userIds),
|
||||
SysUserSyncOutbox.EventBatchDelete,
|
||||
new { userIds },
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user