add 操作人
This commit is contained in:
@@ -105,4 +105,9 @@ public class DeviceTaskAssignmentResponse
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
public int CreateBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
public string Creator { get; set; }
|
||||
}
|
||||
@@ -17,11 +17,15 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
private readonly IUserApi _userApi;
|
||||
|
||||
public DeviceTaskAssignmentService(IDbContext dbContext, ITenantApi tenantApi)
|
||||
public DeviceTaskAssignmentService(IDbContext dbContext,
|
||||
ITenantApi tenantApi,
|
||||
IUserApi userApi)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_tenantApi = tenantApi;
|
||||
_userApi = userApi;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DeviceTaskAssignmentResponse>> GetPageAsync(DeviceTaskAssignmentRequest request)
|
||||
@@ -81,6 +85,17 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
|
||||
//ignore
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var userIds = page.Data.Select(x => x.CreateBy).Distinct().ToList();
|
||||
var userInfos = await _userApi.GetUserByIdsAsync(userIds);
|
||||
page.Data.ForEach(item => item.Creator = userInfos.FirstOrDefault(x => x.Id == item.CreateBy)?.OperatorName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user