fix external支持外包人员

This commit is contained in:
2024-06-14 15:21:35 +08:00
parent c1417e667d
commit 86c7111c19
4 changed files with 22 additions and 7 deletions

View File

@@ -89,6 +89,9 @@ 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();
@@ -111,6 +114,8 @@ public class GainfoFaceService : IGainfoFaceService
await _faceDbContext.UpdateAsync(face);
}
await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, DeviceTaskEnumType.Add);
}
public async Task<string> GetExternalFaceAsync(string idno)
@@ -125,8 +130,11 @@ public class GainfoFaceService : IGainfoFaceService
throw new UserFriendlyException("凭证有误,无法获取人脸数");
}
var code = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == idno).Select(x => x.Code).FirstAsync();
code ??= idno;
var face = await _faceDbContext.Queryable<GainfoFaceEntity>()
.Where(x => x.UserCode == idno)
.Where(x => x.UserCode == code)
.SingleAsync();
face.ThrowIfNull("人脸照片尚未录入");
@@ -208,7 +216,7 @@ public class GainfoFaceService : IGainfoFaceService
var prefix = gainfo.Factory == "501" ? "jschuneng" : "jingke";
var url = $"https://pay.aizhuhotel.com/{prefix}/api/face";
//生成任务
await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, taskType);

View File

@@ -28,8 +28,8 @@ public class GainfoOutsourceService : IGainfoOutsourceService
{
var entity = request.Adapt<GainfoEntity>();
entity.No = Guid.NewGuid().ToString();
entity.Code = request.Code.IsPresent()
? request.Code
entity.Code = request.Code.IsPresent()
? request.Code
: await GetOutSourceCodeAsync();
await _dbContext.InsertAsync(entity);
@@ -71,7 +71,8 @@ public class GainfoOutsourceService : IGainfoOutsourceService
SapPhone = a.SapPhone,
Name = c.Name,
EntryDate = b.EntryDate,
ResignationDate = b.ResignationDate
ResignationDate = b.ResignationDate,
Factory = b.Factory
})
.SingleAsync();
}