fix face数据同步
This commit is contained in:
12
Src/Dlhis.Basic/Organization/Api/IHainingApi.cs
Normal file
12
Src/Dlhis.Basic/Organization/Api/IHainingApi.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Dlhis.Basic.Organization.Api.Request;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Api;
|
||||
|
||||
[EnableRemoteClient(Name = "haining-service", BaseUrl = "https://pay.aizhuhotel.com")]
|
||||
public interface IHainingApi
|
||||
{
|
||||
[RequestLog]
|
||||
[Post("/jingke/api/face/SaveFaceByFace")]
|
||||
Task<object> UploadAsync(HainingApiUploadRequest request);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Api.Request;
|
||||
|
||||
public class HainingApiUploadRequest
|
||||
{
|
||||
[JsonProperty("employeeNo")]
|
||||
public string Code { get; set; }
|
||||
|
||||
[JsonProperty("photoBase64")]
|
||||
public string Base64 { get; set; }
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public class GainfoSaveRequest : IValidatableObject
|
||||
[EnumDataType(typeof(GainfoStatusEnumType))]
|
||||
public GainfoStatusEnumType? GainfoStatus { get; set; }
|
||||
|
||||
public string SapNo { get; set; }
|
||||
public string InternalNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
|
||||
@@ -13,9 +13,9 @@ public class GainfoDetailResponse
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SAP内部编号
|
||||
/// 内部编号
|
||||
/// </summary>
|
||||
public string SapNo { get; set; }
|
||||
public string InternalNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
|
||||
@@ -14,7 +14,7 @@ public class GainfoPageResponse
|
||||
/// <summary>
|
||||
/// SAP内部编号
|
||||
/// </summary>
|
||||
public string SapNo { get; set; }
|
||||
public string InternalNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员类型
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Api;
|
||||
using Dlhis.Basic.Organization.Api.Request;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Dto;
|
||||
@@ -30,6 +32,7 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
private readonly IHangfireApi _hangfireApi;
|
||||
private readonly IDevicePermissionService _devicePermissionService;
|
||||
private readonly IFactorySettingService _factorySettingService;
|
||||
private readonly IHainingApi _hainingApi;
|
||||
private readonly IInfoCheckApi _infoCheckApi;
|
||||
private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||
|
||||
@@ -41,6 +44,7 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
IHangfireApi hangfireApi,
|
||||
IDevicePermissionService devicePermissionService,
|
||||
IFactorySettingService factorySettingService,
|
||||
IHainingApi hainingApi,
|
||||
IInfoCheckApi infoCheckApi,
|
||||
IDataProtectionProvider dataProtectionProvider)
|
||||
{
|
||||
@@ -53,6 +57,7 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
_hangfireApi = hangfireApi;
|
||||
_devicePermissionService = devicePermissionService;
|
||||
_factorySettingService = factorySettingService;
|
||||
_hainingApi = hainingApi;
|
||||
_infoCheckApi = infoCheckApi;
|
||||
_dataProtectionProvider = dataProtectionProvider;
|
||||
}
|
||||
@@ -238,6 +243,19 @@ public class GainfoFaceService : IGainfoFaceService
|
||||
_logger.LogError(e, "上传face数据到sap失败:{message}", e.Message);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _hainingApi.UploadAsync(new HainingApiUploadRequest()
|
||||
{
|
||||
Code = gainfo.Code,
|
||||
Base64 = request.Face
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "上传face数据到老系统失败:{message}", e.Message);
|
||||
}
|
||||
|
||||
//生成任务
|
||||
await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, taskType, DeviceTaskSourceEnumType.Photo);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
@@ -32,11 +33,11 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
||||
.AnyAsync();
|
||||
isOutsource.ThrowIfTrue("对接人不可为外包人员");
|
||||
|
||||
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<GainfoEntity>();
|
||||
entity.No = Guid.NewGuid().ToString();
|
||||
entity.Type = GainfoUserTypeEnumType.Outsource;
|
||||
entity.Code = request.Code.IsPresent()
|
||||
? request.Code
|
||||
: await GetOutSourceCodeAsync();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Api;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
@@ -27,6 +28,7 @@ public class GainfoService : IGainfoService
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
private readonly IHangfireApi _hangfireApi;
|
||||
private readonly IHainingApi _hainingApi;
|
||||
private readonly IDevicePermissionService _devicePermissionService;
|
||||
private readonly IGainfoPermissionService _gainfoPermissionService;
|
||||
private readonly ILogger<GainfoService> _logger;
|
||||
@@ -37,6 +39,7 @@ public class GainfoService : IGainfoService
|
||||
ICurrentUser currentUser,
|
||||
ITenantApi tenantApi,
|
||||
IHangfireApi hangfireApi,
|
||||
IHainingApi hainingApi,
|
||||
IDevicePermissionService devicePermissionService,
|
||||
IGainfoPermissionService gainfoPermissionService,
|
||||
ILogger<GainfoService> logger)
|
||||
@@ -47,6 +50,7 @@ public class GainfoService : IGainfoService
|
||||
_currentUser = currentUser;
|
||||
_tenantApi = tenantApi;
|
||||
_hangfireApi = hangfireApi;
|
||||
_hainingApi = hainingApi;
|
||||
_devicePermissionService = devicePermissionService;
|
||||
_gainfoPermissionService = gainfoPermissionService;
|
||||
_logger = logger;
|
||||
@@ -351,7 +355,7 @@ public class GainfoService : IGainfoService
|
||||
.Select((ga, de, pos, type) => new GainfoDetailResponse
|
||||
{
|
||||
No = ga.No,
|
||||
SapNo = ga.SapNo,
|
||||
InternalNo = ga.InternalNo,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
IdClass = ga.IdClass,
|
||||
|
||||
Reference in New Issue
Block a user