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

@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Org.BouncyCastle.Crypto.Digests;
namespace Dlhis.Basic.Organization.Request;
@@ -22,7 +23,7 @@ public class GainfoUploadFaceRequest : IValidatableObject
bool v = true;
try
{
Convert.FromBase64String(Face);
_ = Convert.FromBase64String(Face);
}
catch (Exception)
{
@@ -34,4 +35,4 @@ public class GainfoUploadFaceRequest : IValidatableObject
yield return new ValidationResult("人脸照片需要为Base64格式", new[] { nameof(Face) });
}
}
}
}

View File

@@ -18,4 +18,9 @@ public class GainfoOutSourceExternalInfoResponse : GainfoOutSourceExternalInfoDt
/// 离职日期
/// </summary>
public DateTime? ResignationDate { get; set; }
/// <summary>
/// 厂区
/// </summary>
public string Factory { get; set; }
}

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