From f5a3e1fe7cfc05df8fc55bbc5e092e3538e32df1 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 14 Jun 2024 15:51:40 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=90=8C=E6=97=B6=E8=BF=94=E5=9B=9EuserN?= =?UTF-8?q?o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/GainfosController.cs | 7 +++---- .../Organization/Services/IGainfoService.cs | 2 +- .../Services/Implements/GainfoService.cs | 17 +++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs index 240ff13a..aca93c44 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs @@ -184,11 +184,11 @@ public class GainfosController : ControllerBase /// [AllowAnonymous] [HttpPost("check/idnoWithName")] - public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request) + public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request) { return await _gainfoService.CheckIdNoAndNameMatchAsync(request); } - + /// /// 离职 /// @@ -199,5 +199,4 @@ public class GainfosController : ControllerBase { await _gainfoService.ResignAsync(request); } -} - +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs index f236ef7f..a74430e3 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs @@ -18,7 +18,7 @@ public interface IGainfoService : IScopeDependency Task MigrationAsync(MigrationRequest request); - Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request); + Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request); Task ResignAsync(GainfoResignRequest request); } diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 54f057da..a1396e50 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -159,18 +159,19 @@ public class GainfoService : IGainfoService return info; } - public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request) + public async Task CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request) { - var match = await _gainfoStore.Queryable(GainfoStatusEnumType.External).AnyAsync(x => x.IdNo == request.IdNo && x.Name == request.Name); - if (!match) - { - match = await _gainfoStore.Queryable(GainfoStatusEnumType.Working).AnyAsync(x => x.IdNo == request.IdNo && x.Name == request.Name); - } + var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External).FirstAsync(x => x.IdNo == request.IdNo && x.Name == request.Name) + ?? await _gainfoStore.Queryable(GainfoStatusEnumType.Working).FirstAsync(x => x.IdNo == request.IdNo && x.Name == request.Name); - match.ThrowIfFalse("验证失败!"); + gainfo.ThrowIfNull("验证失败!"); var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno"); - return protector.Protect(request.IdNo); + return new + { + loginPass = protector.Protect(request.IdNo), + UserNo = gainfo.No + }; }