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))]
|
[EnumDataType(typeof(GainfoStatusEnumType))]
|
||||||
public GainfoStatusEnumType? GainfoStatus { get; set; }
|
public GainfoStatusEnumType? GainfoStatus { get; set; }
|
||||||
|
|
||||||
public string SapNo { get; set; }
|
public string InternalNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 姓名
|
/// 姓名
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ public class GainfoDetailResponse
|
|||||||
public string No { get; set; }
|
public string No { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SAP内部编号
|
/// 内部编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SapNo { get; set; }
|
public string InternalNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 姓名
|
/// 姓名
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class GainfoPageResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// SAP内部编号
|
/// SAP内部编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SapNo { get; set; }
|
public string InternalNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 人员类型
|
/// 人员类型
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Dlhis.Basic.Device.Services;
|
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.Request;
|
||||||
using Dlhis.Basic.Organization.Response;
|
using Dlhis.Basic.Organization.Response;
|
||||||
using Dlhis.Entity.Basic.Dto;
|
using Dlhis.Entity.Basic.Dto;
|
||||||
@@ -30,6 +32,7 @@ public class GainfoFaceService : IGainfoFaceService
|
|||||||
private readonly IHangfireApi _hangfireApi;
|
private readonly IHangfireApi _hangfireApi;
|
||||||
private readonly IDevicePermissionService _devicePermissionService;
|
private readonly IDevicePermissionService _devicePermissionService;
|
||||||
private readonly IFactorySettingService _factorySettingService;
|
private readonly IFactorySettingService _factorySettingService;
|
||||||
|
private readonly IHainingApi _hainingApi;
|
||||||
private readonly IInfoCheckApi _infoCheckApi;
|
private readonly IInfoCheckApi _infoCheckApi;
|
||||||
private readonly IDataProtectionProvider _dataProtectionProvider;
|
private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||||
|
|
||||||
@@ -41,6 +44,7 @@ public class GainfoFaceService : IGainfoFaceService
|
|||||||
IHangfireApi hangfireApi,
|
IHangfireApi hangfireApi,
|
||||||
IDevicePermissionService devicePermissionService,
|
IDevicePermissionService devicePermissionService,
|
||||||
IFactorySettingService factorySettingService,
|
IFactorySettingService factorySettingService,
|
||||||
|
IHainingApi hainingApi,
|
||||||
IInfoCheckApi infoCheckApi,
|
IInfoCheckApi infoCheckApi,
|
||||||
IDataProtectionProvider dataProtectionProvider)
|
IDataProtectionProvider dataProtectionProvider)
|
||||||
{
|
{
|
||||||
@@ -53,6 +57,7 @@ public class GainfoFaceService : IGainfoFaceService
|
|||||||
_hangfireApi = hangfireApi;
|
_hangfireApi = hangfireApi;
|
||||||
_devicePermissionService = devicePermissionService;
|
_devicePermissionService = devicePermissionService;
|
||||||
_factorySettingService = factorySettingService;
|
_factorySettingService = factorySettingService;
|
||||||
|
_hainingApi = hainingApi;
|
||||||
_infoCheckApi = infoCheckApi;
|
_infoCheckApi = infoCheckApi;
|
||||||
_dataProtectionProvider = dataProtectionProvider;
|
_dataProtectionProvider = dataProtectionProvider;
|
||||||
}
|
}
|
||||||
@@ -238,6 +243,19 @@ public class GainfoFaceService : IGainfoFaceService
|
|||||||
_logger.LogError(e, "上传face数据到sap失败:{message}", e.Message);
|
_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);
|
await _devicePermissionService.GenerateDeviceTasksAsync(gainfo.No, taskType, DeviceTaskSourceEnumType.Photo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Dlhis.Basic.Organization.Request;
|
using Dlhis.Basic.Organization.Request;
|
||||||
using Dlhis.Basic.Organization.Response;
|
using Dlhis.Basic.Organization.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
|
using Dlhis.Entity.Basic.Enums;
|
||||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||||
using Kurisu.AspNetCore.Utils;
|
using Kurisu.AspNetCore.Utils;
|
||||||
using Kurisu.AspNetCore.Utils.Extensions;
|
using Kurisu.AspNetCore.Utils.Extensions;
|
||||||
@@ -32,11 +33,11 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
|||||||
.AnyAsync();
|
.AnyAsync();
|
||||||
isOutsource.ThrowIfTrue("对接人不可为外包人员");
|
isOutsource.ThrowIfTrue("对接人不可为外包人员");
|
||||||
|
|
||||||
|
|
||||||
if (!request.Id.HasValue)
|
if (!request.Id.HasValue)
|
||||||
{
|
{
|
||||||
var entity = request.Adapt<GainfoEntity>();
|
var entity = request.Adapt<GainfoEntity>();
|
||||||
entity.No = Guid.NewGuid().ToString();
|
entity.No = Guid.NewGuid().ToString();
|
||||||
|
entity.Type = GainfoUserTypeEnumType.Outsource;
|
||||||
entity.Code = request.Code.IsPresent()
|
entity.Code = request.Code.IsPresent()
|
||||||
? request.Code
|
? request.Code
|
||||||
: await GetOutSourceCodeAsync();
|
: await GetOutSourceCodeAsync();
|
||||||
@@ -63,7 +64,7 @@ public class GainfoOutsourceService : IGainfoOutsourceService
|
|||||||
request.Adapt(entity);
|
request.Adapt(entity);
|
||||||
entity.IdNo = idNo;
|
entity.IdNo = idNo;
|
||||||
entity.Phone = phone;
|
entity.Phone = phone;
|
||||||
|
|
||||||
outsource!.Code = entity.Code;
|
outsource!.Code = entity.Code;
|
||||||
request.ExternalInfo.Adapt(outsource);
|
request.ExternalInfo.Adapt(outsource);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Dlhis.Basic.Device.Services;
|
using Dlhis.Basic.Device.Services;
|
||||||
|
using Dlhis.Basic.Organization.Api;
|
||||||
using Dlhis.Basic.Organization.Request;
|
using Dlhis.Basic.Organization.Request;
|
||||||
using Dlhis.Basic.Organization.Response;
|
using Dlhis.Basic.Organization.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
@@ -27,6 +28,7 @@ public class GainfoService : IGainfoService
|
|||||||
private readonly ICurrentUser _currentUser;
|
private readonly ICurrentUser _currentUser;
|
||||||
private readonly ITenantApi _tenantApi;
|
private readonly ITenantApi _tenantApi;
|
||||||
private readonly IHangfireApi _hangfireApi;
|
private readonly IHangfireApi _hangfireApi;
|
||||||
|
private readonly IHainingApi _hainingApi;
|
||||||
private readonly IDevicePermissionService _devicePermissionService;
|
private readonly IDevicePermissionService _devicePermissionService;
|
||||||
private readonly IGainfoPermissionService _gainfoPermissionService;
|
private readonly IGainfoPermissionService _gainfoPermissionService;
|
||||||
private readonly ILogger<GainfoService> _logger;
|
private readonly ILogger<GainfoService> _logger;
|
||||||
@@ -37,6 +39,7 @@ public class GainfoService : IGainfoService
|
|||||||
ICurrentUser currentUser,
|
ICurrentUser currentUser,
|
||||||
ITenantApi tenantApi,
|
ITenantApi tenantApi,
|
||||||
IHangfireApi hangfireApi,
|
IHangfireApi hangfireApi,
|
||||||
|
IHainingApi hainingApi,
|
||||||
IDevicePermissionService devicePermissionService,
|
IDevicePermissionService devicePermissionService,
|
||||||
IGainfoPermissionService gainfoPermissionService,
|
IGainfoPermissionService gainfoPermissionService,
|
||||||
ILogger<GainfoService> logger)
|
ILogger<GainfoService> logger)
|
||||||
@@ -47,6 +50,7 @@ public class GainfoService : IGainfoService
|
|||||||
_currentUser = currentUser;
|
_currentUser = currentUser;
|
||||||
_tenantApi = tenantApi;
|
_tenantApi = tenantApi;
|
||||||
_hangfireApi = hangfireApi;
|
_hangfireApi = hangfireApi;
|
||||||
|
_hainingApi = hainingApi;
|
||||||
_devicePermissionService = devicePermissionService;
|
_devicePermissionService = devicePermissionService;
|
||||||
_gainfoPermissionService = gainfoPermissionService;
|
_gainfoPermissionService = gainfoPermissionService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@@ -351,7 +355,7 @@ public class GainfoService : IGainfoService
|
|||||||
.Select((ga, de, pos, type) => new GainfoDetailResponse
|
.Select((ga, de, pos, type) => new GainfoDetailResponse
|
||||||
{
|
{
|
||||||
No = ga.No,
|
No = ga.No,
|
||||||
SapNo = ga.SapNo,
|
InternalNo = ga.InternalNo,
|
||||||
Name = ga.Name,
|
Name = ga.Name,
|
||||||
Code = ga.Code,
|
Code = ga.Code,
|
||||||
IdClass = ga.IdClass,
|
IdClass = ga.IdClass,
|
||||||
|
|||||||
Reference in New Issue
Block a user