add FactoryName

This commit is contained in:
2025-01-10 17:42:59 +08:00
parent 9edc5041fa
commit 3ce23bd07b
2 changed files with 20 additions and 2 deletions

View File

@@ -34,4 +34,7 @@ public class GainfoFacePageResponse
/// 是否存在人脸
/// </summary>
public bool Exists { get; set; }
public string Factory { get; set; }
public string FactoryName { get; set; }
}

View File

@@ -10,6 +10,7 @@ using Dlhis.InfoCheck.Api;
using Dlhis.InfoCheck.Api.Requests;
using Dlhis.Jip.Api;
using Dlhis.Jip.Api.Requests;
using Dlhis.Sys.Api;
using Kurisu.AspNetCore.Authentication.Abstractions;
using Kurisu.AspNetCore.CustomClass;
using Kurisu.AspNetCore.DataAccess.Extensions;
@@ -33,6 +34,7 @@ public class GainfoFaceService : IGainfoFaceService
private readonly IHainingApi _hainingApi;
private readonly IInfoCheckApi _infoCheckApi;
private readonly IJinkoJipApi _jinkoJipApi;
private readonly ITenantApi _tenantApi;
private readonly IDataProtectionProvider _dataProtectionProvider;
public GainfoFaceService(IGainfoStore gainfoStore,
@@ -45,12 +47,13 @@ public class GainfoFaceService : IGainfoFaceService
IHainingApi hainingApi,
IInfoCheckApi infoCheckApi,
IJinkoJipApi jinkoJipApi,
ITenantApi tenantApi,
IDataProtectionProvider dataProtectionProvider)
{
_logger = logger;
_gainfoStore = gainfoStore;
_dbContext = dbContext;
_faceDbContext = dbContext.ChangeDb("face");
_logger = logger;
_configuration = configuration;
_currentUser = currentUser;
_devicePermissionService = devicePermissionService;
@@ -58,6 +61,7 @@ public class GainfoFaceService : IGainfoFaceService
_hainingApi = hainingApi;
_infoCheckApi = infoCheckApi;
_jinkoJipApi = jinkoJipApi;
_tenantApi = tenantApi;
_dataProtectionProvider = dataProtectionProvider;
}
@@ -79,13 +83,24 @@ public class GainfoFaceService : IGainfoFaceService
UserCode = x.Code,
UserName = x.Name,
DepartmentName = d.Name,
Exists = false
Exists = false,
Factory = x.Factory
})
.ToListAsync();
var page = list.ToPage(request);
page.Data.ForEach(x => { x.Exists = existsFaceCodes.Contains(x.UserCode); });
try
{
var tenants = await _tenantApi.GetTenantsInternalAsync();
page.Data.ForEach(x => { x.FactoryName = tenants.FirstOrDefault(p => p.Code == x.Factory)?.Name; });
}
catch (Exception e)
{
_logger.LogError(e, "处理tenant错误:{msg}", e.Message);
}
return new GainfoFacePageSummaryResponse
{
Total = userCodes.Count,