fix 手动上传访客照片支持上传大华

This commit is contained in:
2025-11-14 15:06:43 +08:00
parent c84b8e4954
commit 3f1f6d1525

View File

@@ -127,24 +127,6 @@ public class AppointmentService : IAppointmentService
await GenerateDeviceTasksAsync(detail, false, DeviceTaskEnumType.Add, "访客门岗认证生成");
}
private async Task UploadFaceToDhAsync(string idNo, string base64Image)
{
try
{
var r = await _dhApi.SendFaceAsync(new FaceRequest
{
IdNo = idNo,
Face = base64Image
});
_logger.LogInformation("上传face数据到大华成功: {idNo} . {json}", idNo, r.ToJson());
}
catch (Exception e)
{
_logger.LogError(e, "上传face数据到大华失败:{msg}", e.Message);
}
}
public async Task<AppointmentDetailResponse> GetTodayByIdNoAsync(string idNo, string factory)
{
var protector = _dataProtectionProvider.CreateProtector("gainfo:external:idno");
@@ -185,7 +167,6 @@ public class AppointmentService : IAppointmentService
.FirstAsync();
}
public async Task FocusLeaveAsync(long id, string reason)
{
// 根据访客预约详情ID获取记录,若不存在则抛出异常
@@ -327,6 +308,8 @@ public class AppointmentService : IAppointmentService
var detail = await _dbContext.Queryable<VisitorAppointmentDetailEntity>().Where(x => x.Id == detailId).SingleAsync();
detail.ThrowIfNull("数据不存在");
await UploadFaceToDhAsync(detail.IdNo, base64);
await _gainfoFaceService.UploadExternalFaceAsync(new GainfoUploadFaceRequest
{
UserNo = detail.IdNo,
@@ -470,4 +453,23 @@ public class AppointmentService : IAppointmentService
}
}
}
private async Task UploadFaceToDhAsync(string idNo, string base64Image)
{
try
{
var r = await _dhApi.SendFaceAsync(new FaceRequest
{
IdNo = idNo,
Face = base64Image
});
_logger.LogInformation("上传face数据到大华成功: {idNo} . {json}", idNo, r.ToJson());
}
catch (Exception e)
{
_logger.LogError(e, "上传face数据到大华失败:{msg}", e.Message);
}
}
}