fix 外包人员拍照触发下发问题

This commit is contained in:
2024-07-09 15:06:46 +08:00
parent c5ca376fd3
commit dffc7feac2
3 changed files with 11 additions and 4 deletions

View File

@@ -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<GainfoFaceEntity>().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<string> GetExternalFaceAsync(string idno)

View File

@@ -58,7 +58,12 @@ public class GainfoOutsourceService : IGainfoOutsourceService
var outsource = await _dbContext.Queryable<OutsourceEntity>().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);