From dffc7feac2f79c6833bad3fc825d2e393ad1655c Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 9 Jul 2024 15:06:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A4=96=E5=8C=85=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E6=8B=8D=E7=85=A7=E8=A7=A6=E5=8F=91=E4=B8=8B=E5=8F=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Organization/Controllers/GainfosController.cs | 3 ++- .../Organization/Services/Implements/GainfoFaceService.cs | 7 ++++--- .../Services/Implements/GainfoOutsourceService.cs | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs index aca93c44..f1205510 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs @@ -76,6 +76,7 @@ public class GainfosController : ControllerBase /// /// [AllowAnonymous] + [IgnoreTenant] [HttpPost("external/face")] public async Task UploadExternalFaceAsync(GainfoUploadFaceRequest request) { @@ -83,7 +84,7 @@ public class GainfosController : ControllerBase } /// - /// 外部人员人脸照片 + /// 获取外部人员人脸照片 /// /// /// diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs index be553662..3138ea9d 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoFaceService.cs @@ -54,7 +54,7 @@ public class GainfoFaceService : IGainfoFaceService .Where(x => x.Factory == request.Factory) .WhereIF(request.Exists.HasValue && request.Exists.Value, x => existsFaceCodes.Contains(x.Code)) .WhereIF(request.Exists.HasValue && !request.Exists.Value, x => !existsFaceCodes.Contains(x.Code)) - .WhereIF(request.Search.IsPresent(),x=>x.Code == request.Search) + .WhereIF(request.Search.IsPresent(), x => x.Code == request.Search) .Select((x, d) => new GainfoFacePageResponse { UserCode = x.Code, @@ -90,13 +90,14 @@ public class GainfoFaceService : IGainfoFaceService var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External) .Where(x => x.IdNo == request.UserNo) .FirstAsync(); + gainfo ??= await _gainfoStore.Queryable(GainfoStatusEnumType.Working) .Where(x => x.IdNo == request.UserNo) .FirstAsync(); gainfo.ThrowIfNull("人员信息不存在"); var face = await _faceDbContext.Queryable().Where(x => x.UserCode == gainfo.Code).SingleAsync(); - + var taskType = face == null ? DeviceTaskEnumType.Add : DeviceTaskEnumType.Update; if (face == null) { face = new GainfoFaceEntity @@ -116,7 +117,7 @@ public class GainfoFaceService : IGainfoFaceService await _faceDbContext.UpdateAsync(face); } - await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, DeviceTaskEnumType.Add); + await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, taskType); } public async Task GetExternalFaceAsync(string idno) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs index 21d18ab7..8cdf99e0 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs @@ -58,7 +58,12 @@ public class GainfoOutsourceService : IGainfoOutsourceService var outsource = await _dbContext.Queryable().FirstAsync(x => x.Code == entity.Code); (outsource == null).ThrowIfTrue("不可编辑非外包人员档案数据"); + var idNo = entity.IdNo; + var phone = entity.Phone; request.Adapt(entity); + entity.IdNo = idNo; + entity.Phone = phone; + outsource!.Code = entity.Code; request.ExternalInfo.Adapt(outsource);