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);