From 3ce23bd07bbc28715bbccb7244b83440b22fe50b Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 10 Jan 2025 17:42:59 +0800 Subject: [PATCH] add FactoryName --- .../Response/GainfoFacePageResponse.cs | 3 +++ .../Services/Implements/GainfoFaceService.cs | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoFacePageResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoFacePageResponse.cs index 313221b0..d0b5cfc3 100644 --- a/Src/Dlhis.Basic/Organization/Response/GainfoFacePageResponse.cs +++ b/Src/Dlhis.Basic/Organization/Response/GainfoFacePageResponse.cs @@ -34,4 +34,7 @@ public class GainfoFacePageResponse /// 是否存在人脸 /// public bool Exists { get; set; } + + public string Factory { get; set; } + public string FactoryName { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs index bcbdf0d2..0c26af6c 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs @@ -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,